Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crawler] javlib数据抓取异常(无法绕开反爬措施) #16

Open
superneock opened this issue Oct 18, 2021 · 6 comments
Open

Comments

@superneock
Copy link

release 0.5,所有影片抓取javlib均提示该错误:

2021-10-18 23:04:20 main ERROR: Crawler: web.javlib: MILD-873: 未处理的异常: Detected a Cloudflare version 2 challenge, This feature is not available in the opensource (free) version.
Traceback (most recent call last):
cloudscraper.exceptions.CloudflareChallengeError: Detected a Cloudflare version 2 challenge, This feature is not available in the opensource (free) version.

是否使用代理
无,人在境外

@Yuukiy
Copy link
Owner

Yuukiy commented Oct 21, 2021

这算是一个已知问题,主要是由于网站的反爬策略引起的。javlib和javdb套了CloudFlare保护,目前的解决方案是使用cloudscraper这个模块绕过反爬,但是cloudscraper的开源版本只提供基础的绕过,并不能完全绕开反爬(Cloudflare version 2 challenge),所以会有这样的问题。
可能的临时办法:我个人测试和体验中来看,可能过一段时间又能爬取这些网站的数据了,但是网络环境不同,不确定是否适用于你的情况。

@superneock
Copy link
Author

这算是一个已知问题,主要是由于网站的反爬策略引起的。javlib和javdb套了CloudFlare保护,目前的解决方案是使用cloudscraper这个模块绕过反爬,但是cloudscraper的开源版本只提供基础的绕过,并不能完全绕开反爬(Cloudflare version 2 challenge),所以会有这样的问题。 可能的临时办法:我个人测试和体验中来看,可能过一段时间又能爬取这些网站的数据了,但是网络环境不同,不确定是否适用于你的情况。

谢谢。不过我观察到,当爬取过程中出现错误的同时,用浏览器(Chrome/Edge)访问的话却并没有captcha challenge,是否可以套一个浏览器agent再抓?

@Yuukiy
Copy link
Owner

Yuukiy commented Oct 22, 2021

开源版的cloudscraper就已经内置了很多user agent,但是还是无法完全通过验证。所以单纯的套agent没有办法解决问题。
从反爬的角度来考虑的话,一个真实用户的浏览器和爬虫的差异还是很大的,绝大多数基于python的爬虫不带js引擎,没有办法执行js指令;此外还有很多接口方面的测试(比如获取用户字体列表、屏幕分辨率、窗口大小等),爬虫也是无法一一模拟响应的。
我能设想到一些可能用来检查爬虫与真实用户的差异点,但是我没有技术能力绕开,而且实际上我也并不知道CF是如何检测爬虫的,所以这个问题暂时无解。

@Nolovenodie
Copy link

开源版的cloudscraper就已经内置了很多user agent,但是还是无法完全通过验证。所以单纯的套agent没有办法解决问题。 从反爬的角度来考虑的话,一个真实用户的浏览器和爬虫的差异还是很大的,绝大多数基于python的爬虫不带js引擎,没有办法执行js指令;此外还有很多接口方面的测试(比如获取用户字体列表、屏幕分辨率、窗口大小等),爬虫也是无法一一模拟响应的。 我能设想到一些可能用来检查爬虫与真实用户的差异点,但是我没有技术能力绕开,而且实际上我也并不知道CF是如何检测爬虫的,所以这个问题暂时无解。

可以使用 playwright 模拟绕过~

@fanza1
Copy link

fanza1 commented Dec 14, 2021

Cloudflare version 2可以用cloudscraper的收费3rd Party Captcha Solvers,我用过2captcha,当时想移植过来但是感觉挺麻烦的,所以作罢了,这个问题感觉目前无解,javlib站点自我防御开得有点高

reference:https://pypi.org/project/cloudscraper/

@Yuukiy Yuukiy changed the title [crawler] javlib数据抓取异常 [crawler] javlib数据抓取异常(无法绕开反爬措施) Mar 26, 2022
@glyh
Copy link
Collaborator

glyh commented Mar 10, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants