Anorov / cloudflare-scrape

A Python module to bypass Cloudflare's anti-bot page.
MIT License
3.35k stars 458 forks source link

Pages Showing Are You Human After Few Attempts #72

Closed nomanaliii closed 8 years ago

nomanaliii commented 8 years ago

I am running python script on Mac, and have a list of Urls in a text file. Yesterday script was scraping all Urls correctly, but today all Urls showing cpatcha "Are you human?".

Note: All Urls are of one website: Kissmanga.com screen shot 2016-08-01 at 10 05 13 am i think its showing only from my ip. What could be the solution?

Twoure commented 8 years ago

One reason may be you are not keeping the cookies before they expire, resulting in unnecessary calls to cloudflare to gain fresh cookies for the same IP. I assume cloudflare keeps track of how long the cookies should be active per IP but not sure.

Example Expire time:

import re
import cfscrape

cookie_value, user_agent = cfscrape.get_cookie_string("http://somesite.com")
#cookie_value = "cf_clearance=c8f913c707b818b47aa328d81cab57c349b1eee5-1426733163-3600; __cfduid=dd8ec03dfdbcb8c2ea63e920f1335c1001426733158"

r = re.search(r'cf_clearance\=.*\-(\d+)\-(\d+)', cookie_value)
expire = int(r.group(1)) + int(r.group(2)) if r else None
#1426736763

Some more info from cloudflare can be found here. For now, you can try opening a web browser from the IP that ran your code, open the kissmanga chapter and check the human verification. For some, doing this once gets there code to work again.

Bottom line, your issue most likely stems from the fact that in the past you made too many bad requests to cloudflare, ultimately resulting in your IP being flagged. That said, I could be off-base, and you may have other issues, perhaps with the source site.

nomanaliii commented 8 years ago

I checked captcha once, Added above cookie code and ran my script. It worked. Great thanks for saving my a**. Claps