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

version 2.0.5 crash with get_cookie_string() and get_tokens() #256

Closed
ricopter opened this issue May 23, 2019 · 2 comments
Closed

version 2.0.5 crash with get_cookie_string() and get_tokens() #256

ricopter opened this issue May 23, 2019 · 2 comments
Labels
duplicate outdated deps Errors associated with using an old peer dependency

Comments

@ricopter
Copy link

ricopter commented May 23, 2019

Before creating an issue, first upgrade cfscrape with pip install -U cfscrape and see if you're still experiencing the problem.

Version number

Run pip show cfscrape and paste the output below:

Name: cfscrape
Version: 2.0.5
Summary: A simple Python module to bypass Cloudflare's anti-bot page. See https://github.com/Anorov/cloudflare-scrape for more information.
Home-page: https://github.com/Anorov/cloudflare-scrape
Author: Anorov
Author-email: anorov.vorona@gmail.com
License: UNKNOWN
Location: /usr/local/lib/python2.7/dist-packages
Requires: requests
Required-by:

Code snippet experiencing the issue

import cfscrape

scraper = cfscrape.create_scraper() # returns a CloudflareScraper instance

Complete exception and traceback

traceback

ERROR:root:Error executing Cloudflare IUAM Javascript. Cloudflare may have changed their technique, or there may be a bug in the script.

Please read https://github.com/Anorov/cloudflare-scrape#updates, then file a bug report at https://github.com/Anorov/cloudflare-scrape/issues."
ERROR:root:'https://vww.torrent9.onl/torrents/films/1' returned an error. Could not collect tokens.
Traceback (most recent call last):
File "/var/www/cloudflare/cloudflare_scrape.py", line 10, in
cookie_value, user_agent = cfscrape.get_cookie_string(url)
File "/usr/local/lib/python2.7/dist-packages/cfscrape/init.py", line 373, in get_cookie_string
tokens, user_agent = cls.get_tokens(url, user_agent=user_agent, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cfscrape/init.py", line 340, in get_tokens
resp = scraper.get(url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cfscrape/init.py", line 132, in request
resp = self.solve_cf_challenge(resp, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/cfscrape/init.py", line 185, in solve_cf_challenge
answer, delay = self.solve_challenge(body, domain)
File "/usr/local/lib/python2.7/dist-packages/cfscrape/init.py", line 284, in solve_challenge
["node", "-e", js], stdin=subprocess.PIPE, stderr=subprocess.PIPE
File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['node', '-e', u' var atob = Object.setPrototypeOf(function (str) { try { return Buffer.from("" + str, "base64").toString("binary"); } catch (e) {} }, null); var challenge = atob("CiAgICAgICAgICAgICAgICB2YXIgZG9jdW1lbnQgPSB7CiAgICAgICAgICAgICAgICAgICAgY3JlYXRlRWxlbWVudDogZnVuY3Rpb24gKCkgewogICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHsgZmlyc3RDaGlsZDogeyBocmVmOiAiaHR0cDovL3Z3dy50b3JyZW50OS5vbmwvIiB9IH0KICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIGdldEVsZW1lbnRCeUlkOiBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geyJpbm5lckhUTUwiOiAiKygoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoKyEhW10pKygrW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoKyEhW10pKS8rKCgrISFbXStbXSkrKCErW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCtbXSkrKCErW10rISFbXSkrKCtbXSkrKCErW10rISFbXSkrKCErW10rISFbXSkpIn07CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9OwoKICAgICAgICAgICAgICAgIHZhciBzLHQsbyxwLGIscixlLGEsayxpLG4sZyxmLCBHcnZ3WnpzPXsiSkpvUiI6KygoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rW10pKyghK1tdKyEhW10pKygrW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSkrKCErW10rISFbXSshIVtdKSkvKygoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSkpfTsKICAgICAgICBnID0gU3RyaW5nLmZyb21DaGFyQ29kZTsKICAgICAgICBvID0gIkFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky89IjsKICAgICAgICBlID0gZnVuY3Rpb24ocykgewogICAgICAgICAgcyArPSAiPT0iLnNsaWNlKDIgLSAocy5sZW5ndGggJiAzKSk7CiAgICAgICAgICB2YXIgYm0sIHIgPSAiIiwgcjEsIHIyLCBpID0gMDsKICAgICAgICAgIGZvciAoOyBpIDwgcy5sZW5ndGg7KSB7CiAgICAgICAgICAgICAgYm0gPSBvLmluZGV4T2Yocy5jaGFyQXQoaSsrKSkgPDwgMTggfCBvLmluZGV4T2Yocy5jaGFyQXQoaSsrKSkgPDwgMTIKICAgICAgICAgICAgICAgICAgICAgIHwgKHIxID0gby5pbmRleE9mKHMuY2hhckF0KGkrKykpKSA8PCA2IHwgKHIyID0gby5pbmRleE9mKHMuY2hhckF0KGkrKykpKTsKICAgICAgICAgICAgICByICs9IHIxID09PSA2NCA/IGcoYm0gPj4gMTYgJiAyNTUpCiAgICAgICAgICAgICAgICAgICAgICA6IHIyID09PSA2NCA/IGcoYm0gPj4gMTYgJiAyNTUsIGJtID4+IDggJiAyNTUpCiAgICAgICAgICAgICAgICAgICAgICA6IGcoYm0gPj4gMTYgJiAyNTUsIGJtID4+IDggJiAyNTUsIGJtICYgMjU1KTsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByOwogICAgICAgIH07CiAgICAgICAgdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2RpdicpOwogICAgICAgIHQuaW5uZXJIVE1MPSI8YSBocmVmPScvJz54PC9hPiI7CiAgICAgICAgdCA9IHQuZmlyc3RDaGlsZC5ocmVmO3IgPSB0Lm1hdGNoKC9odHRwcz86XC9cLy8pWzBdOwogICAgICAgIHQgPSB0LnN1YnN0cihyLmxlbmd0aCk7IHQgPSB0LnN1YnN0cigwLHQubGVuZ3RoLTEpOyBrID0gJ2NmLWRuLW90U1doU0ZhSWgnOwogICAgICAgIGEgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnanNjaGwtYW5zd2VyJyk7CiAgICAgICAgZiA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdjaGFsbGVuZ2UtZm9ybScpOwogICAgICAgIDtHcnZ3WnpzLkpKb1IqPSsoKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSkrKCtbXSkrKCErW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSkpLysoKCErW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKTtHcnZ3WnpzLkpKb1IrPSsoKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCErW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSkrKCshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkpLysoKCErW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKygrISFbXSkrKCshIVtdKSk7R3J2d1p6cy5KSm9SKz0rKCghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCErW10rISFbXSshIVtdKyEhW10pKygrISFbXSkrKCtbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKygrISFbXSkpLygrKCsoKCshIVtdK1tdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10pKSkrKGZ1bmN0aW9uKHApe3JldHVybiBldmFsKCh0cnVlKyIiKVswXSsiLmNoIisoZmFsc2UrIiIpWzFdKyh0cnVlKyIiKVsxXStGdW5jdGlvbigicmV0dXJuIGVzY2FwZSIpKCkoKCIiKVsiaXRhbGljcyJdKCkpWzJdKyJvIisodW5kZWZpbmVkKyIiKVsyXSsodHJ1ZSsiIilbM10rIkEiKyh0cnVlKyIiKVswXSsiKCIrcCsiKSIpfSgrKCgrISFbXStbXSkrKCErW10rISFbXSkpKSkpO0dydndaenMuSkpvUi09KygoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdK1tdKSsoIStbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKygrW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSkvKygoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10pKygrW10pKTtHcnZ3WnpzLkpKb1IqPSsoKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSkrKCshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCshIVtdKSkvKygoIStbXSshIVtdKyEhW10rISFbXSshIVtdK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSk7R3J2d1p6cy5KSm9SKz0rKCghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rW10pKygrISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10pKygrW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10pKS8rKCgrISFbXStbXSkrKCtbXSkrKCtbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkpO0dydndaenMuSkpvUio9ZnVuY3Rpb24ocCl7dmFyIHAgPSBldmFsKGV2YWwoZSgiWkc5amRXMWwiKSsodW5kZWZpbmVkKyIiKVsxXSsodHJ1ZSsiIilbMF0rKCsoKyErW10rWyshK1tdXSsoISFbXStbXSlbIStbXSshK1tdKyErW11dK1shK1tdKyErW11dK1srW11dKStbXSlbKyErW11dK2coMTAzKSsodHJ1ZSsiIilbM10rKHRydWUrIiIpWzBdKyJFbGVtZW50IitnKDY2KSsoTmFOK1tJbmZpbml0eV0pWzEwXSsiSWQoIitnKDEwNykrIikuIitlKCJhVzV1WlhKSVZFMU0iKSkpOyByZXR1cm4gKyhwKX0oKTtHcnZ3WnpzLkpKb1IrPSsoKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXStbXSkrKCshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSkrKCtbXSkrKCErW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSkpLysoKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdK1tdKSsoIStbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKTtHcnZ3WnpzLkpKb1ItPSsoKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdK1tdKSsoIStbXSshIVtdKSsoK1tdKSsoIStbXSshIVtdKyEhW10rISFbXSkrKCshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10pKyghK1tdKyEhW10rISFbXSkpLysoKCErW10rISFbXSshIVtdK1tdKSsoKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10rISFbXSshIVtdKSsoIStbXSshIVtdKyEhW10rISFbXSshIVtdKyEhW10pKyghK1tdKyEhW10rISFbXSshIVtdKyEhW10rISFbXSkrKCErW10rISFbXSshIVtdKyEhW10pKTthLnZhbHVlID0gKCtHcnZ3WnpzLkpKb1IpLnRvRml4ZWQoMTApOyAnOyAxMjEnOyBhLnZhbHVlCiAgICAgICAgICAgIA=="); var context = Object.setPrototypeOf({ atob: atob }, null); var options = { filename: "iuam-challenge.js", contextOrigin: "cloudflare:iuam-challenge.js", contextCodeGeneration: { strings: true, wasm: false }, timeout: 5000 }; process.stdout.write(String( require("vm").runInNewContext(challenge, context, options) )); ']' returned non-zero exit status 8

URL of the Cloudflare-protected page

https://vww.torrent9.onl/torrents/films/1

URL of Pastebin/Gist with HTML source of protected page

view-source:https://vww.torrent9.onl/torrents/films/1

@ricopter ricopter added the bug label May 23, 2019
@ricopter ricopter changed the title version 2.0.5 crash with specific page version 2.0.5 crash with get_cookie_string May 23, 2019
@ricopter ricopter changed the title version 2.0.5 crash with get_cookie_string version 2.0.5 crash with get_cookie_string() May 23, 2019
@ricopter ricopter changed the title version 2.0.5 crash with get_cookie_string() version 2.0.5 crash with get_cookie_string() and get_tokens() May 23, 2019
@ghost
Copy link

ghost commented May 23, 2019

Hi @ricopter,

Node.js version?

@ricopter
Copy link
Author

The version of nodejs is an old version installed on debian 8, I switched to debian 9 and everything works perfectly. thank you

@ghost ghost added outdated deps Errors associated with using an old peer dependency duplicate and removed bug labels May 24, 2019
@ghost ghost mentioned this issue Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate outdated deps Errors associated with using an old peer dependency
Projects
None yet
Development

No branches or pull requests

1 participant