当前位置:网站首页>如何使用pywinauto和pyautogui将动漫小姐姐链接请回家
如何使用pywinauto和pyautogui将动漫小姐姐链接请回家
2022-08-01 22:32:00 【东方金木】
首先确定链接
https://author.baidu.com/home/1584651610617850
使用chrime浏览
将该页面下拉到底部
F12
copy
所有页面源码
以字符串赋值给python变量
使用下面代码抓取链接
import re
data=re.compile('nid=dt_[0-9]+').findall(url_data)
data=["https://mbd.baidu.com/newspage/data/dtlandingsuper?"+i for i in data]
# print()
from pywinauto import Application
from pywinauto import mouse
import pyautogui
import time
import pyperclip
chrome_dir="C:/Program Files/Google/Chrome/Application/chrome.exe"
chrome = Application(backend='uia')
for one in data:
chrome.start(chrome_dir + ' --force-renderer-accessibility --incognito --start-maximized '+one,timeout=5)
mouse.move(coords=(420, 420))
time.sleep(0.5)
mouse.move(coords=(490, 490))
# mouse.double_click(button='left', coords=(200, 200))
# pyautogui.click(490,490,duration=0.5)
pyautogui.press("F12")
pyautogui.click(1520,300,duration=0.5)
pyautogui.click(1520,500,duration=0.5)
send_keys=""" document.querySelector("#app > div > div.app-module_contentWrapper_12u0y > div > div.app-module_leftSection_2GBVu > div.index-module_articleContainer_32gOp > div.index-module_contentContainer_3mQeg > div > div > div > div > div > div:nth-child(1) > div.index-module_img_2Y2y2.index-module_border-radius-tl_14YCd").click() """
pyperclip.copy(send_keys)
pyautogui.hotkey('ctrl','v')
pyautogui.press("enter")
send_keys=""" (function(console){ console.save = function(data, filename){ if(!data) { console.error('Console.save: No data') return; } if(!filename) filename = 'console.json' if(typeof data === "object"){ data = JSON.stringify(data, undefined, 4) } var blob = new Blob([data], {type: 'text/json'}), e = document.createEvent('MouseEvents'), a = document.createElement('a') a.download = filename a.href = window.URL.createObjectURL(blob) a.dataset.downloadurl = ['text/json', a.download, a.href].join(':') e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null) a.dispatchEvent(e) } })(console); var image_count=document.querySelector("#app > div > div.app-module_contentWrapper_12u0y > div > div.app-module_leftSection_2GBVu > div.index-module_articleContainer_32gOp > div.index-module_contentContainer_3mQeg > div > div > div > div > div > div > div").childElementCount; var turl="" for (i=4;i<=image_count;i++) {var url=document.querySelector("#app > div > div.app-module_contentWrapper_12u0y > div > div.app-module_leftSection_2GBVu > div.index-module_articleContainer_32gOp > div.index-module_contentContainer_3mQeg > div > div > div > div > div > div > div > div:nth-child("+i+") > img").getAttribute("src"); console.log(url); turl+="#####"+url;}; console.save(turl,"x.txt") """
pyperclip.copy(send_keys)
pyautogui.hotkey('ctrl','v')
pyautogui.press("enter")
time.sleep(2)
最后合并下载文件
使用迅雷下载即可
上例源码和链接
https://download.csdn.net/download/weixin_32759777/86268530
边栏推荐
- 牛客多校4 A.Task Computing 思维
- 2022 版 MySQL 巅峰教程,收藏好,慢慢看
- 联邦学习入门
- 使用Jenkins做持续集成,这个知识点必须要掌握
- [Mobile Web] Mobile terminal adaptation
- (Translation) How the contrasting color of the button guides the user's actions
- 编曲软件FL studio20.8中文版功能和作用
- No more rolls!After joining ByteDance for a week, he ran decisively.
- render-props and higher order components
- Error creating bean with name ‘dataSource‘:Unsatisfied dependency expressed through field ‘basicPro
猜你喜欢

小程序毕设作品之微信体育馆预约小程序毕业设计成品(4)开题报告

威纶通触摸屏如何打开并升级EB8000旧版本项目并更换触摸屏型号?

2022年最新河北建筑八大员(机械员)模拟考试题库及答案

y84.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十五)

小程序毕设作品之微信美食菜谱小程序毕业设计成品(5)任务书

联邦学习在金融领域的发展和应用

深度学习Course2第二周Optimization Algorithms习题整理

编曲软件FL studio20.8中文版功能和作用

No more rolls!After joining ByteDance for a week, he ran decisively.

数据分析04
随机推荐
联邦学习的框架搭建
VGUgarbage collector(垃圾回收器)的实现原理
入门数据库Days4
APP special test: traffic test
Lecture 3: Several common table field data types in MySQL database
[Mobile Web] Mobile terminal adaptation
The must-have "fishing artifact" for programmers is here!
2022 版 MySQL 巅峰教程,收藏好,慢慢看
求解多元多次方程解的个数
得物客服热线的演进之路
leetcode刷题
企业公众号文章写作方向:如何写出读者认可的优质内容
罗克韦尔AB PLC RSLogix5000中的比较指令使用方法介绍
[机缘参悟-58]:《素书》-5-奉行仁义[遵义章第五]
[ASM] Bytecode Operation MethodWriter
小程序毕设作品之微信体育馆预约小程序毕业设计成品(1)开发概要
Recycling rental system 100% open source without encryption Mall + recycling + rental
Deep learning Course2 first week Practical aspects of Deep Learning exercises
xctf攻防世界 Web高手进阶区 webshell
Delicious this year