mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-09 05:21:13 +02:00
Update to cloudscraper v1.2.52
This commit is contained in:
parent
967993cef2
commit
ffde5bfdb5
1 changed files with 22 additions and 1 deletions
|
|
@ -58,7 +58,7 @@ from .user_agent import User_Agent
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
__version__ = '1.2.50'
|
__version__ = '1.2.52'
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
|
@ -302,6 +302,27 @@ class CloudScraper(Session):
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------- #
|
||||||
|
# check if the response contains a valid Cloudflare Bot Fight Mode challenge
|
||||||
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def is_BFM_Challenge(resp):
|
||||||
|
try:
|
||||||
|
return (
|
||||||
|
resp.headers.get('Server', '').startswith('cloudflare')
|
||||||
|
and re.search(
|
||||||
|
r"\/cdn-cgi\/bm\/cv\/\d+\/api\.js.*?"
|
||||||
|
r"window\['__CF\$cv\$params'\]\s*=\s*{",
|
||||||
|
resp.text,
|
||||||
|
re.M | re.S
|
||||||
|
)
|
||||||
|
)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
# check if the response contains a valid Cloudflare challenge
|
# check if the response contains a valid Cloudflare challenge
|
||||||
# ------------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------------- #
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue