🍿*★,°*:.☆欢迎您/$:*.°★* 🍿 |
目录
背景
正文
总结
背景描述
这个是为了测试jspath 的有效性 |
正文
如上次一样使用chrome copy jspath 后调试载console 中
同时可以使用for 循环载console 中获得前期的链接如下 后期
使用selenium 进行迭代处理处理后
分析结果拼接 使用迅雷批量下载
#https://pvp.qq.com/web201605/herolist.shtml
# document.querySelector("body > div.wrapper > div > div > div.herolist-box > div.herolist-content > ul").childElementCount
#
url_l="""
https://pvp.qq.com/web201605/herodetail/521.shtml
https://pvp.qq.com/web201605/herodetail/548.shtml
https://pvp.qq.com/web201605/herodetail/534.shtml
https://pvp.qq.com/web201605/herodetail/542.shtml
https://pvp.qq.com/web201605/herodetail/540.shtml
https://pvp.qq.com/web201605/herodetail/538.shtml
https://pvp.qq.com/web201605/herodetail/155.shtml
https://pvp.qq.com/web201605/herodetail/537.shtml
https://pvp.qq.com/web201605/herodetail/528.shtml
https://pvp.qq.com/web201605/herodetail/536.shtml
https://pvp.qq.com/web201605/herodetail/533.shtml
https://pvp.qq.com/web201605/herodetail/527.shtml
https://pvp.qq.com/web201605/herodetail/531.shtml
https://pvp.qq.com/web201605/herodetail/524.shtml
https://pvp.qq.com/web201605/herodetail/525.shtml
https://pvp.qq.com/web201605/herodetail/523.shtml
https://pvp.qq.com/web201605/herodetail/518.shtml
https://pvp.qq.com/web201605/herodetail/522.shtml
https://pvp.qq.com/web201605/herodetail/506.shtml
https://pvp.qq.com/web201605/herodetail/505.shtml
https://pvp.qq.com/web201605/herodetail/529.shtml
https://pvp.qq.com/web201605/herodetail/511.shtml
https://pvp.qq.com/web201605/herodetail/515.shtml
https://pvp.qq.com/web201605/herodetail/513.shtml
https://pvp.qq.com/web201605/herodetail/507.shtml
https://pvp.qq.com/web201605/herodetail/312.shtml
https://pvp.qq.com/web201605/herodetail/508.shtml
https://pvp.qq.com/web201605/herodetail/509.shtml
https://pvp.qq.com/web201605/herodetail/137.shtml
https://pvp.qq.com/web201605/herodetail/510.shtml
https://pvp.qq.com/web201605/herodetail/125.shtml
https://pvp.qq.com/web201605/herodetail/504.shtml
https://pvp.qq.com/web201605/herodetail/503.shtml
https://pvp.qq.com/web201605/herodetail/197.shtml
https://pvp.qq.com/web201605/herodetail/502.shtml
https://pvp.qq.com/web201605/herodetail/176.shtml
https://pvp.qq.com/web201605/herodetail/199.shtml
https://pvp.qq.com/web201605/herodetail/501.shtml
https://pvp.qq.com/web201605/herodetail/179.shtml
https://pvp.qq.com/web201605/herodetail/198.shtml
https://pvp.qq.com/web201605/herodetail/194.shtml
https://pvp.qq.com/web201605/herodetail/195.shtml
https://pvp.qq.com/web201605/herodetail/196.shtml
https://pvp.qq.com/web201605/herodetail/193.shtml
https://pvp.qq.com/web201605/herodetail/189.shtml
https://pvp.qq.com/web201605/herodetail/182.shtml
https://pvp.qq.com/web201605/herodetail/187.shtml
https://pvp.qq.com/web201605/herodetail/191.shtml
https://pvp.qq.com/web201605/herodetail/192.shtml
https://pvp.qq.com/web201605/herodetail/190.shtml
https://pvp.qq.com/web201605/herodetail/180.shtml
https://pvp.qq.com/web201605/herodetail/186.shtml
https://pvp.qq.com/web201605/herodetail/184.shtml
https://pvp.qq.com/web201605/herodetail/183.shtml
https://pvp.qq.com/web201605/herodetail/178.shtml
https://pvp.qq.com/web201605/herodetail/177.shtml
https://pvp.qq.com/web201605/herodetail/175.shtml
https://pvp.qq.com/web201605/herodetail/174.shtml
https://pvp.qq.com/web201605/herodetail/173.shtml
https://pvp.qq.com/web201605/herodetail/171.shtml
https://pvp.qq.com/web201605/herodetail/170.shtml
https://pvp.qq.com/web201605/herodetail/169.shtml
https://pvp.qq.com/web201605/herodetail/168.shtml
https://pvp.qq.com/web201605/herodetail/167.shtml
https://pvp.qq.com/web201605/herodetail/166.shtml
https://pvp.qq.com/web201605/herodetail/163.shtml
https://pvp.qq.com/web201605/herodetail/162.shtml
https://pvp.qq.com/web201605/herodetail/157.shtml
https://pvp.qq.com/web201605/herodetail/156.shtml
https://pvp.qq.com/web201605/herodetail/154.shtml
https://pvp.qq.com/web201605/herodetail/153.shtml
https://pvp.qq.com/web201605/herodetail/152.shtml
https://pvp.qq.com/web201605/herodetail/150.shtml
https://pvp.qq.com/web201605/herodetail/149.shtml
https://pvp.qq.com/web201605/herodetail/148.shtml
https://pvp.qq.com/web201605/herodetail/146.shtml
https://pvp.qq.com/web201605/herodetail/144.shtml
https://pvp.qq.com/web201605/herodetail/142.shtml
https://pvp.qq.com/web201605/herodetail/141.shtml
https://pvp.qq.com/web201605/herodetail/140.shtml
https://pvp.qq.com/web201605/herodetail/139.shtml
https://pvp.qq.com/web201605/herodetail/136.shtml
https://pvp.qq.com/web201605/herodetail/135.shtml
https://pvp.qq.com/web201605/herodetail/134.shtml
https://pvp.qq.com/web201605/herodetail/133.shtml
https://pvp.qq.com/web201605/herodetail/132.shtml
https://pvp.qq.com/web201605/herodetail/131.shtml
https://pvp.qq.com/web201605/herodetail/130.shtml
https://pvp.qq.com/web201605/herodetail/129.shtml
https://pvp.qq.com/web201605/herodetail/128.shtml
https://pvp.qq.com/web201605/herodetail/127.shtml
https://pvp.qq.com/web201605/herodetail/126.shtml
https://pvp.qq.com/web201605/herodetail/124.shtml
https://pvp.qq.com/web201605/herodetail/123.shtml
https://pvp.qq.com/web201605/herodetail/121.shtml
https://pvp.qq.com/web201605/herodetail/120.shtml
https://pvp.qq.com/web201605/herodetail/119.shtml
https://pvp.qq.com/web201605/herodetail/118.shtml
https://pvp.qq.com/web201605/herodetail/117.shtml
https://pvp.qq.com/web201605/herodetail/116.shtml
https://pvp.qq.com/web201605/herodetail/115.shtml
https://pvp.qq.com/web201605/herodetail/114.shtml
https://pvp.qq.com/web201605/herodetail/113.shtml
https://pvp.qq.com/web201605/herodetail/112.shtml
https://pvp.qq.com/web201605/herodetail/111.shtml
https://pvp.qq.com/web201605/herodetail/110.shtml
https://pvp.qq.com/web201605/herodetail/109.shtml
https://pvp.qq.com/web201605/herodetail/108.shtml
https://pvp.qq.com/web201605/herodetail/107.shtml
https://pvp.qq.com/web201605/herodetail/106.shtml
https://pvp.qq.com/web201605/herodetail/105.shtml"""
# document.querySelector("body > div.wrapper > div.zk-con1.zk-con > div > div > div.pic-pf > ul").childElementCount
# document.querySelector("body > div.wrapper > div.zk-con1.zk-con").getAttribute("style")
# background: url("//game.gtimg.cn/images/yxzj/img201606/skin/hero-info/155/155-bigskin-3.jpg")
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
# 设置打开浏览器
options = Options()
options.add_argument("--start-maximized")
options.add_experimental_option(
'excludeSwitches', ['enable-logging', 'enable-automation'])
options.add_argument("profile-directory={profile}")
options.add_argument("--incognito")
chrome_dir=r"C:/Users/Administrator/AppData/Local/Google Chrome/Chromebin/chrome.exe"
options.binary_location = chrome_dir
browser_driver = webdriver.Chrome(ChromeDriverManager().install(), options=options)
# 打开首页
# browser_driver.get("https://pvp.qq.com/web201605/herolist.shtml")
# # 获得链接数量
# num=browser_driver.execute_script("""return document.querySelector("body > div.wrapper > div > div > div.herolist-box > div.herolist-content > ul").childElementCount""")
# #
# url_list=[]
# for i in range(int(num)):
# # 获取url
#
# url=browser_driver.execute_script("""return document.querySelector("body > div.wrapper > div > div > div.herolist-box > div.herolist-content > ul").children[0].children[0].href""")
url_list_a=[]
for i in url_l.split():
# html=chrome.start(chrome_dir + ' --force-renderer-accessibility --incognito --start-maximized ' + i, timeout=5)
browser_driver.get(i)
num=browser_driver.execute_script("""return document.querySelector("body > div.wrapper > div.zk-con1.zk-con > div > div > div.pic-pf > ul").childElementCount""")
url_one=browser_driver.execute_script("""return document.querySelector("body > div.wrapper > div.zk-con1.zk-con").getAttribute("style")""")
name=url_one[16:-11]
for j in range(1,int(num)+1):
name=name[:-5] + "{}".format(j) +name[-4:]
url_list_a.append("https:"+name)
# browser_driver.close()
print(name)
# with open("result_url.text","a",encoding="utf-8") as f:
# f.writelines(url_list_a)
总结
后期处理很重要 重点是使用迅雷批量下载
- 📢欢迎点赞 👍 收藏 ⭐留言 📝 如有错误敬请指正!
- 📢本文由东方佑原创,首发于 CSDN博客🙉
- 📢停下休息的时候不要忘了别人还在奔跑,希望大家抓紧时间学习,全力奔赴更美好的生活✨