cloudflare-scrape icon indicating copy to clipboard operation
cloudflare-scrape copied to clipboard

Kissanime Series Downloader : AttributeError: 'NoneType' object has no attribute 'groups' and ValueError: Unable to identify Cloudflare IUAM Javascript on website. Cloudflare may have changed their technique, or there may be a bug in the script.

Open lovekrissh143 opened this issue 4 years ago • 2 comments

Before creating an issue, first upgrade cfscrape with pip install -U cfscrape and see if you're still experiencing the problem. Please also confirm your Node version (node --version or nodejs --version) is version 10 or higher.

Make sure the website you're having issues with is actually using anti-bot protection by Cloudflare and not a competitor like Imperva Incapsula or Sucuri. And if you're using an anonymizing proxy, a VPN, or Tor, Cloudflare often flags those IPs and may block you or present you with a captcha as a result.

Please confirm the following statements and check the boxes before creating an issue:

  • [yes] I've upgraded cfscrape with pip install -U cfscrape
  • [yes] I'm using Node version 10 or higher
  • [yes] The site protection I'm having issues with is from Cloudflare
  • [yes] I'm not using Tor, a VPN, or an anonymizing proxy

Please HELP ME ANOROV :) HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Python version number

Run python --version and paste the output below:

Python 3.7.0

cfscrape version number

Run pip show cfscrape and paste the output below:

Name: cfscrape
Version: 2.1.1
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: [email protected]
License: UNKNOWN
Location: c:\users\krissh\pycharmprojects\kissin\venv\lib\site-packages
Requires: requests
Required-by:

Code snippet involved with the issue

                logging.info("Cookie Needs Update")
                session.headers.update({
                    'Cookie': '',
                })  # Clear previous cookie
                logging.info("Clear Previous Cookie!")
                logging.info("Return Scraper!")
                scrape = cfscrape.create_scraper(sess=session)
                logging.debug(scrape)
                try:
                    logging.info("Scraper Https Connect Try!")
                    tkn, agt = scrape.get_cookie_string(
                        BASE_URL_SSL, user_agent=user_agent
                    )
                except Exception as e:
                    logging.info("Scraper Failed Https but Http Connect Try! : {}".format(e))
                    tkn, agt = scrape.get_cookie_string(
                        BASE_URL, user_agent=user_agent
                    )
                logging.debug("Token : {} and Agent : {}".format(tkn, agt))

Complete exception and traceback

(If the problem doesn't involve an exception being raised, leave this blank)

C:\Users\Krissh\PycharmProjects\kissin\venv\Scripts\python.exe C:/Users/Krissh/PycharmProjects/kissin/example.py
ERROR:root:'https://kissanime.ru/' returned an error. Could not collect tokens.
ERROR:root:'http://kissanime.ru/' returned an error. Could not collect tokens.
Traceback (most recent call last):
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 255, in solve_challenge
    javascript, flags=re.S
AttributeError: 'NoneType' object has no attribute 'groups'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Krissh\PycharmProjects\kissin\KissAnime\new_desktop.py", line 163, in setup_cloudflare
    BASE_URL_SSL, user_agent=user_agent
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 416, in get_cookie_string
    tokens, user_agent = cls.get_tokens(url, user_agent=user_agent, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 383, in get_tokens
    resp = scraper.get(url, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\requests\sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 129, in request
    resp = self.solve_cf_challenge(resp, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 204, in solve_cf_challenge
    answer, delay = self.solve_challenge(body, domain)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 292, in solve_challenge
    % BUG_REPORT
ValueError: Unable to identify Cloudflare IUAM Javascript on website. 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."

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 255, in solve_challenge
    javascript, flags=re.S
AttributeError: 'NoneType' object has no attribute 'groups'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Krissh/PycharmProjects/kissin/example.py", line 31, in <module>
    main()
  File "C:/Users/Krissh/PycharmProjects/kissin/example.py", line 9, in main
    kiss_desktop = KissyAnime()
  File "C:\Users\Krissh\PycharmProjects\kissin\KissAnime\new_desktop.py", line 359, in __init__
    self.conn = ConnectionHandler()  # Initalize connection handler
  File "C:\Users\Krissh\PycharmProjects\kissin\KissAnime\new_desktop.py", line 51, in __init__
    self.scrape = self.setup_cloudflare()  # Main setup here
  File "C:\Users\Krissh\PycharmProjects\kissin\KissAnime\new_desktop.py", line 168, in setup_cloudflare
    BASE_URL, user_agent=user_agent
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 416, in get_cookie_string
    tokens, user_agent = cls.get_tokens(url, user_agent=user_agent, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 383, in get_tokens
    resp = scraper.get(url, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\requests\sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 129, in request
    resp = self.solve_cf_challenge(resp, **kwargs)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 204, in solve_cf_challenge
    answer, delay = self.solve_challenge(body, domain)
  File "C:\Users\Krissh\PycharmProjects\kissin\venv\lib\site-packages\cfscrape\__init__.py", line 292, in solve_challenge
    % BUG_REPORT
ValueError: Unable to identify Cloudflare IUAM Javascript on website. 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."

Process finished with exit code 1

URL of the Cloudflare-protected page

[kissanime.ru]

URL of Pastebin/Gist with HTML source of protected page

[https://pastebin.com/LytGCxgW]

lovekrissh143 avatar Apr 22 '20 02:04 lovekrissh143

https://github.com/Anorov/cloudflare-scrape/issues/350#issuecomment-618112438

At least this has a temporary solution. I think the developer of this library isn't looking at the problems of thousands of his followers. Please Look @Anorov Thanks! :)

lovekrissh143 avatar Apr 23 '20 02:04 lovekrissh143

#350 (comment)

At least this has a temporary solution. I think the developer of this library isn't looking at the problems of thousands of his followers. Please Look @Anorov Thanks! :) This might be unnecessary. I REQUIRE you to read the LICENSE here:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

This is an exerpt...

harieamjari avatar May 19 '20 07:05 harieamjari