|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我找不到周免英雄的地方,只有91(?)个英雄,而我只想爬取周免的英雄
↑周免英雄
↑所有的
然后我get的就是第二个的...
有什么办法可以获取周免?
好了
- from selenium import webdriver
- from requests import get
- import os
- try:
- os.mkdir("Img")
- os.chdir("Img")
- except:
- os.chdir("Img")
-
- wd = webdriver.Chrome(r'D:\webdrivers\chromedriver.exe')
- wd.get('https://pvp.qq.com/web201605/herolist.shtml')
- wd.find_element_by_xpath('/html/body/div[3]/div/div/div[2]/div[1]/ul[2]/li[1]/span/i').click()
- url = wd.find_elements_by_xpath('/html/body/div[3]/div/div/div[2]/div[2]/ul/li/a/img')
- for i in range(len(url)):
- with open(f"{i}.jpg", 'wb') as f:
- f.write(get(url[i].get_attribute("src")).content)
- wd.quit()
复制代码
|
|