fix: dy login fix

This commit is contained in:
Relakkes 2025-04-08 20:58:04 +08:00
parent afbd4ec1bf
commit 660fd18a95
3 changed files with 8 additions and 3 deletions

View File

@ -7,6 +7,11 @@ A: 该错误为缺少 nodejs 环境,这个错误可以通过安装 nodejs 环
Q: 使用Cookie爬取抖音报错: execjs._exceptions.ProgramError: TypeError: Cannot read property 'JS_MD5_NO_COMMON_JS' of null Q: 使用Cookie爬取抖音报错: execjs._exceptions.ProgramError: TypeError: Cannot read property 'JS_MD5_NO_COMMON_JS' of null
A: windows电脑去网站下载`https://nodejs.org/en/blog/release/v16.8.0` Windows 64-bit Installer 版本,一直下一步即可。 A: windows电脑去网站下载`https://nodejs.org/en/blog/release/v16.8.0` Windows 64-bit Installer 版本,一直下一步即可。
## xhs登录出现滑块一直验证不通过问题
Q: 小红书扫码登录成功后,浏览器一直在验证滑块,无法登录?<br>
A: 这种情况一般是因为使用playwright浏览器驱动被识别出来的问题可以尝试删除项目目录下的`brower_data`文件夹,重新走登录流程。<br>
## 如何指定关键词 ## 如何指定关键词
Q: 可以指定关键词爬取吗?<br> Q: 可以指定关键词爬取吗?<br>
A: 在config/base_config.py 中 KEYWORDS 参数用于控制需要爬取的关键词 <br> A: 在config/base_config.py 中 KEYWORDS 参数用于控制需要爬取的关键词 <br>

View File

@ -101,7 +101,7 @@ class DouYinLogin(AbstractLogin):
async def popup_login_dialog(self): async def popup_login_dialog(self):
"""If the login dialog box does not pop up automatically, we will manually click the login button""" """If the login dialog box does not pop up automatically, we will manually click the login button"""
dialog_selector = "xpath=//div[@id='login-pannel']" dialog_selector = "xpath=//div[@id='login-panel-new']"
try: try:
# check dialog box is auto popup and wait for 10 seconds # check dialog box is auto popup and wait for 10 seconds
await self.context_page.wait_for_selector(dialog_selector, timeout=1000 * 10) await self.context_page.wait_for_selector(dialog_selector, timeout=1000 * 10)
@ -114,7 +114,7 @@ class DouYinLogin(AbstractLogin):
async def login_by_qrcode(self): async def login_by_qrcode(self):
utils.logger.info("[DouYinLogin.login_by_qrcode] Begin login douyin by qrcode...") utils.logger.info("[DouYinLogin.login_by_qrcode] Begin login douyin by qrcode...")
qrcode_img_selector = "xpath=//article[@class='web-login']//img" qrcode_img_selector = "xpath=//div[@id='animate_qrcode_container']//img"
base64_qrcode_img = await utils.find_login_qrcode( base64_qrcode_img = await utils.find_login_qrcode(
self.context_page, self.context_page,
selector=qrcode_img_selector selector=qrcode_img_selector

View File

@ -4,7 +4,7 @@ author = "程序员阿江-Relakkes <relakkes@gmail.com>"
version = "0.1.0" version = "0.1.0"
description = "A social media crawler project, support Xiaohongshu, Weibo, Zhihu, Bilibili, Douyin, BaiduTieBa etc." description = "A social media crawler project, support Xiaohongshu, Weibo, Zhihu, Bilibili, Douyin, BaiduTieBa etc."
readme = "README.md" readme = "README.md"
requires-python = "==3.9" requires-python = ">=3.9"
dependencies = [ dependencies = [
"aiofiles~=23.2.1", "aiofiles~=23.2.1",
"aiomysql==0.2.0", "aiomysql==0.2.0",