anime-downloader: Animepahe broken again
Describe the bug Error while trying to download from animepahe, ERROR: ‘NoneType’ object has no attribute ‘group’
I remember there was this error before too that got fixed.
To reproduce
anime dl 'https://animepahe.com/anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83' --episodes 16:18 --quality 720p
You can try different anime too…
LOG
$ anime --log-level DEBUG dl 'https://animepahe.com/anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83' --episodes 16:18 --quality 720p
2020-05-26 22:19:35 wolf anime_downloader.util[10441] INFO anime-downloader 4.3.0
2020-05-26 22:19:35 wolf anime_downloader.util[10441] DEBUG Platform: Linux-4.19.0-6-amd64-x86_64-with-MX-19.1-patito_feo
2020-05-26 22:19:35 wolf anime_downloader.util[10441] DEBUG Python 3.7.3
2020-05-26 22:19:35 wolf anime_downloader.sites.anime[10441] INFO Extracting episode info from page
2020-05-26 22:19:35 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:35 wolf anime_downloader.sites.helpers.request[10441] DEBUG GET https://animepahe.com/anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83
2020-05-26 22:19:35 wolf anime_downloader.sites.helpers.request[10441] DEBUG {}
2020-05-26 22:19:35 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11'}
2020-05-26 22:19:35 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
send: b'GET /anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83 HTTP/1.1\r\nHost: animepahe.com\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.9\r\nAccept-Encoding: gzip, deflate\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Tue, 26 May 2020 16:49:45 GMT
header: Content-Type: text/html; charset=UTF-8
header: Transfer-Encoding: chunked
header: Connection: keep-alive
header: Set-Cookie: __cfduid=dfb25b67e93457558ca99cc490e0c69711590511784; expires=Thu, 25-Jun-20 16:49:44 GMT; path=/; domain=.animepahe.com; HttpOnly; SameSite=Lax; Secure
header: Vary: Accept-Encoding
header: Cache-Control: no-cache, private
header: Set-Cookie: __cfduid=dfb25b67e93457558ca99cc490e0c69711590511784; expires=Thu, 25-Jun-20 16:49:44 GMT; path=/; domain=.animepahe.com; HttpOnly; SameSite=Lax; Secure
header: Set-Cookie: __cfduid=dfb25b67e93457558ca99cc490e0c69711590511784; expires=Thu, 25-Jun-20 16:49:44 GMT; path=/; domain=.animepahe.com; HttpOnly; SameSite=Lax; Secure
header: Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
header: CF-Cache-Status: DYNAMIC
header: cf-request-id: 02f37cebad000002230c83a200000001
header: Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
header: Server: cloudflare
header: CF-RAY: 5998fdbf7f890223-SIN
header: Content-Encoding: gzip
header: alt-svc: h3-27=":443"; ma=86400, h3-25=":443"; ma=86400, h3-24=":443"; ma=86400, h3-23=":443"; ma=86400
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG https://animepahe.com/anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG /tmp/animedlz1faap8m/tmp77wvucaj
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG GET https://animepahe.com/api
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'params': {'m': 'release', 'id': '2330', 'sort': 'episode_asc', 'page': 1}}
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11'}
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:47 wolf anime_downloader.session[10441] DEBUG cached request
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG https://animepahe.com/api?id=2330&m=release&page=1&sort=episode_asc
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG /tmp/animedlz1faap8m/tmp10ipzo1u
2020-05-26 22:19:47 wolf anime_downloader.commands.dl[10441] INFO Found anime: 3-gatsu no Lion 2nd Season
2020-05-26 22:19:47 wolf anime_downloader.sites.anime[10441] DEBUG Extracting stream info of id: https://animepahe.com/anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83/14480
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG GET https://animepahe.com/anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83/14480
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG {}
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11'}
2020-05-26 22:19:47 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
send: b'GET /anime/a64b4cf3-58e8-5307-7fe0-6a6637934a83/14480 HTTP/1.1\r\nHost: animepahe.com\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.9\r\nAccept-Encoding: gzip, deflate\r\nCookie: __cfduid=dfb25b67e93457558ca99cc490e0c69711590511784; XSRF-TOKEN=eyJpdiI6ImpcL0xOTU5ySEd0SGhQZytvR2hQbWJ3PT0iLCJ2YWx1ZSI6InVuY2FaV2kxUVlaV2RlOVNDYTB6a0dKbDV4R2ErcVEzaFZJSWxNVTZ5d0NOMXpcL1BMSDduUXpcL3k0M3JOb0FPRSIsIm1hYyI6IjI0YWM4OGVkN2ExNWViNjI5NDg4NjM1ZWJlZjY2ZjEzYWM0ZTAxNDU3MGM4YWQ2OWM2OTk2MjkwMmZhZjE5YmEifQ%3D%3D; laravel_session=eyJpdiI6Im9rXC9hendIR2lDaGFMVlhHRWNcLzhJUT09IiwidmFsdWUiOiIzaWc2SG5ySlZrRXJ5cXJaSnFTcUFGUXBteGVcLzVoUjdiN3dXbkZLaEJOXC84OUs5WkhtRWJXbngzdElrSWhLeHQiLCJtYWMiOiJjMGFmNjEzYzk5M2FiMTE0ZmY1OTQ1YjVlYzNiNzRlZjJhMmM3MDkyMWUwMWNhODEzMDY5MjVjOWQ1YWRmYzlmIn0%3D\r\n\r\n'
reply: 'HTTP/1.1 302 Found\r\n'
header: Date: Tue, 26 May 2020 16:49:49 GMT
header: Content-Type: text/html; charset=UTF-8
header: Transfer-Encoding: chunked
header: Connection: keep-alive
header: Cache-Control: no-cache, private
header: Location: https://animepahe.com/play/a64b4cf3-58e8-5307-7fe0-6a6637934a83/db9b225c0984b402df72e381e214ce932162ef655ebfd886347d6ec04a3d0285
header: Set-Cookie: XSRF-TOKEN=eyJpdiI6Ind6QTM0THZSUzZXbktaTmVKODQ2dlE9PSIsInZhbHVlIjoiN3U2cE15UUdKa2E2RGJLXC9Oc2dZQ3kyWlNTSktkZjhUUVJPanFyQVFoVFFiT2trWG4zK3pRZkVab09IMGt2Z0YiLCJtYWMiOiI2MGZiZTQyMzQzMjRhZmFkMDZhYTc1NTk5N2VlMjhmNzZiZTE1ZGU2ZDkyN2VlOGEyY2Y2OGE4YWI2YjI5NTdhIn0%3D; expires=Tue, 26-May-2020 18:49:49 GMT; Max-Age=7200; path=/
header: Set-Cookie: XSRF-TOKEN=eyJpdiI6Ind6QTM0THZSUzZXbktaTmVKODQ2dlE9PSIsInZhbHVlIjoiN3U2cE15UUdKa2E2RGJLXC9Oc2dZQ3kyWlNTSktkZjhUUVJPanFyQVFoVFFiT2trWG4zK3pRZkVab09IMGt2Z0YiLCJtYWMiOiI2MGZiZTQyMzQzMjRhZmFkMDZhYTc1NTk5N2VlMjhmNzZiZTE1ZGU2ZDkyN2VlOGEyY2Y2OGE4YWI2YjI5NTdhIn0%3D; expires=Tue, 26-May-2020 18:49:49 GMT; Max-Age=7200; path=/
header: Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
header: CF-Cache-Status: DYNAMIC
header: cf-request-id: 02f37cf82e000002230c9df200000001
header: Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
header: Server: cloudflare
header: CF-RAY: 5998fdd37ab20223-SIN
header: alt-svc: h3-27=":443"; ma=86400, h3-25=":443"; ma=86400, h3-24=":443"; ma=86400, h3-23=":443"; ma=86400
send: b'GET /play/a64b4cf3-58e8-5307-7fe0-6a6637934a83/db9b225c0984b402df72e381e214ce932162ef655ebfd886347d6ec04a3d0285 HTTP/1.1\r\nHost: animepahe.com\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.9\r\nAccept-Encoding: gzip, deflate\r\nCookie: __cfduid=dfb25b67e93457558ca99cc490e0c69711590511784; XSRF-TOKEN=eyJpdiI6Ind6QTM0THZSUzZXbktaTmVKODQ2dlE9PSIsInZhbHVlIjoiN3U2cE15UUdKa2E2RGJLXC9Oc2dZQ3kyWlNTSktkZjhUUVJPanFyQVFoVFFiT2trWG4zK3pRZkVab09IMGt2Z0YiLCJtYWMiOiI2MGZiZTQyMzQzMjRhZmFkMDZhYTc1NTk5N2VlMjhmNzZiZTE1ZGU2ZDkyN2VlOGEyY2Y2OGE4YWI2YjI5NTdhIn0%3D; laravel_session=eyJpdiI6InJRMWYrQXB3MWR6OVhYeWd3NmVnR2c9PSIsInZhbHVlIjoiUnNLb3d3amFOenZnQlo4bUVROVJaMkdGTUhUVEh1NW42VjZiQVYrbXJwbVZ4ZWJcL21haVZKSzNmVGdacmFvSDYiLCJtYWMiOiJiZGNhM2JiY2NkYjJmOGIzMjAwOTA1OGRlNzQxZTBjZTMxMzY3MTc4OGM2OGRiMzA2ODdhMmU5YTcxMzZlMjI0In0%3D\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Tue, 26 May 2020 16:49:51 GMT
header: Content-Type: text/html; charset=UTF-8
header: Transfer-Encoding: chunked
header: Connection: keep-alive
header: Vary: Accept-Encoding
header: Set-Cookie: res=720; expires=Wed, 26-May-2021 16:49:51 GMT; Max-Age=31536000; path=/
header: Cache-Control: no-cache, private
header: Set-Cookie: res=720; expires=Wed, 26-May-2021 16:49:51 GMT; Max-Age=31536000; path=/
header: Set-Cookie: res=720; expires=Wed, 26-May-2021 16:49:51 GMT; Max-Age=31536000; path=/
header: Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
header: CF-Cache-Status: DYNAMIC
header: cf-request-id: 02f37d0309000002230cb20200000001
header: Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
header: Server: cloudflare
header: CF-RAY: 5998fde4d9e10223-SIN
header: Content-Encoding: gzip
header: alt-svc: h3-27=":443"; ma=86400, h3-25=":443"; ma=86400, h3-24=":443"; ma=86400, h3-23=":443"; ma=86400
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG https://animepahe.com/play/a64b4cf3-58e8-5307-7fe0-6a6637934a83/db9b225c0984b402df72e381e214ce932162ef655ebfd886347d6ec04a3d0285
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG /tmp/animedlz1faap8m/tmpov_v6lio
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG GET https://animepahe.com/api
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'params': {'id': '2330', 'm': 'embed', 'p': 'kwik', 'session': 'db9b225c0984b402df72e381e214ce932162ef655ebfd886347d6ec04a3d0285'}}
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11'}
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:52 wolf anime_downloader.session[10441] DEBUG cached request
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG https://animepahe.com/api?id=2330&m=embed&p=kwik&session=db9b225c0984b402df72e381e214ce932162ef655ebfd886347d6ec04a3d0285
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG /tmp/animedlz1faap8m/tmpe8bxr2l2
2020-05-26 22:19:52 wolf anime_downloader.sites.anime[10441] DEBUG Sources : [('kwik', 'https://kwik.cx/e/90ZUuIQT7UMo')]
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG GET https://kwik.cx/e/90ZUuIQT7UMo
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG {}
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11', 'referer': 'https://kwik.cx/e/90ZUuIQT7UMo'}
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG -----
2020-05-26 22:19:52 wolf anime_downloader.session[10441] DEBUG cached request
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG https://kwik.cx/e/90ZUuIQT7UMo
2020-05-26 22:19:52 wolf anime_downloader.sites.helpers.request[10441] DEBUG /tmp/animedlz1faap8m/tmpjtp8uey7
Traceback (most recent call last):
File "/usr/local/bin/anime", line 10, in <module>
sys.exit(main())
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/cli.py", line 53, in main
cli()
File "/home/shen/.local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/shen/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/shen/.local/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/shen/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/shen/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/shen/.local/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/commands/dl.py", line 99, in command
animes = util.parse_ep_str(anime, episode_range)
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/util.py", line 137, in parse_ep_str
for episode in split_anime(anime, episode_grammar):
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/sites/anime.py", line 198, in __iter__
yield episode_class(ep_id[1], parent=self, ep_no=ep_id[0])
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/sites/anime.py", line 293, in __init__
try_data()
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/sites/anime.py", line 291, in try_data
self.source().stream_url
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/extractors/base_extractor.py", line 29, in stream_url
self.get_data()
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/extractors/base_extractor.py", line 41, in get_data
data = self._get_data()
File "/home/shen/.local/lib/python3.7/site-packages/anime_downloader/extractors/kwik.py", line 31, in _get_data
cdn, digits, file, token, expires = stream_parts_re.search(deobsfucated_js).group(1, 2, 3, 4, 5)
AttributeError: 'NoneType' object has no attribute 'group'
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (1 by maintainers)
@LordShenron so it turns everything is fine the first time (which is the time I get the token) - however since the token takes a while to generate (13 tries in one test where I counted), I’m gonna try some way to keep persistence, so we don’t always have to solve captchas, only the first time.
@LordShenron Well, you’re in luck.
So based on some other github project (namely, https://github.com/Futei/SineCaptcha/blob/23ad6d4641abe8de7d04200d45a5c3581ad7d864/main.py) with slight modifications - I have managed to bypass the captcha on Kwik. I did it in a standalone test script, but I’ll likely be working it into the Kwik extractor later.
@LordShenron I’ve changed how I’m finding the script to regex, maybe that’ll work for you?
You can test it by installing it, like so:
pip install -e git+git://github.com/AbdullahM0hamed/anime-downloader@cleanup#egg=anime-downloader
(it should just replace original, but I prefer to uninstall first, just to be certain)Not impossible, just very hard to fix. You’d need to find a way to deobfuscate the Javascript. I’ve tried multiple Javascript deobfuscators and they couldn’t do it.
Could probably make it use the m3u8 in the meanwhile
Looks like they only serve m3u8 streams unless you download the mp4, only problem being that the token needed to start the mp4 download is impossible to deobfuscate.
Kwik issue, investigating. Getting the m3u8 links is easy, trying to crack the mp4 link now.