rewrite invalid cloudflare redirect locations
After solving a challenge on komikcast.com, cloudflare would redirect to https:/komikcast.com (with only one '/') when testing on TravisCI.
This commit is contained in:
parent
0d7e8be987
commit
76df628b13
@ -59,8 +59,11 @@ def solve_challenge(session, response, kwargs):
|
||||
log.debug("Headers:\n%s", cf_response.headers)
|
||||
log.debug("Content:\n%s", cf_response.text)
|
||||
raise exception.StopExtraction()
|
||||
|
||||
if location[0] == "/":
|
||||
location = root + location
|
||||
else:
|
||||
location = re.sub(r"(https?):/(?!/)", r"\1://", location)
|
||||
|
||||
for cookie in cf_response.cookies:
|
||||
if cookie.name == "cf_clearance":
|
||||
|
Loading…
x
Reference in New Issue
Block a user