当前位置:网站首页>如何使用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
边栏推荐
- more grown, more lonely
- JS prototype hasOwnProperty in 加方法 原型终点 继承 重写父类方法
- PHP算法之电话号码的字母组合
- 华为无线设备配置双链路冷备份(AP指定配置方式)
- 【牛客刷题-SQL大厂面试真题】NO4.出行场景(某滴打车)
- 别看了,这就是你的题呀
- 如何防范 DAO 中的治理攻击?
- 美赞臣EDI 940仓库装运订单详解
- 【C语言实现】两种计算平均成绩题型,博主精心整理,值得一读
- Wechat Gymnasium Reservation Mini Program Graduation Design Finished Work Mini Program Graduation Design Finished Product (2) Mini Program Function
猜你喜欢

Analysis of the development trend of game metaverse

feel so stupid

KMP 字符串匹配问题

移动端人脸风格化技术的应用

数据分析04

03. GO language variable definition, function

xctf attack and defense world web master advanced area web2

小程序毕设作品之微信体育馆预约小程序毕业设计成品(3)后台功能

SAP ABAP OData 服务如何支持删除(Delete)操作试读版

2022 edition of MySQL tutorial, top collection good, take your time
随机推荐
自建 Prometheus 采集腾讯云容器服务监控数据最佳实践
SOM网络2: 代码的实现
Yizhou Financial Analysis | The intelligent transformation of bank ATM machines is accelerated; the new Internet loan regulations bring challenges
SQL Server(设计数据库--存储过程--触发器)
三、mysql 存储引擎-建库建表操作
2022年最新河北建筑八大员(机械员)模拟考试题库及答案
How to add a game character to a UE4 scene
统计单词数
dvwa 通关记录1 - 暴力破解 Brute Force
Prufer sequence
APP专项测试:流量测试
Wechat Gymnasium Appointment Mini Program Graduation Design Finished Work (4) Opening Report
APP special test: traffic test
leetcode 204. Count Primes 计数质数 (Easy)
数据分析04
Still struggling with reporting tool selection?To take a look at this
leetcode 204. Count Primes 计数质数 (Easy)
SOM网络1:原理讲解
Today's sleep quality record 74 points
小程序毕设作品之微信体育馆预约小程序毕业设计成品(2)小程序功能