anime-dl
anime-dl copied to clipboard
Cannot use a string pattern on a bytes-like object
Command Line Arguments You Gave: main.py -i "https://www.crunchyroll.com/isekai-quartet/episode-1-come-together-quartet-783515" -u "xxx" -p "xxx"
Verbose Log Link: https://pastebin.com/YeR1evk2
Long Explanation: I first encountered this issue using Python 3.7.3. Thinking it might be related to #27 so I installed Python 3.5.4 but it still shows the same error. The verbose error log is from 3.5.4. Windows binary hasn't been updated to address the "cannot extract language error" that was fixed in master.
The Verbose Log doesn't show the error you got, for any of us to troubleshoot the code, we would need potentially your Console Output that hopefully would show which line of the python code it's failing on.
Otherwise, @Nicnl latest build of the offline EXE can be found here with most of the fixes thus far (I think this was the latest one he posted): https://github.com/Xonshiz/anime-dl/issues/86#issuecomment-476760004
The console output is just these four lines,
Trying to login... Logged in successfully... Seems like this video isn't available... cannot use a string pattern on a bytes-like object
Thanks for the link to the EXE. The binary build does work on my end.
Hmm, odd, sorry I can't help more, but at least the updated EXE works for you.
Hey
The packaged exe works because it's not running Python 3 but Python 2
I don't remember which version exactly, I think it's 2.7? Will check once I'm home from work
When I started fixing the Crunchy issues, I myself tried to run it under Python 3, but I encountered the same problems
I'm not sure why the project was written in Python 2 in the first place, but well
It's just the way it is
looks like the different between those two version is big. I am a PHP programmer, and I don't remember having such big issues when using old script on new PHP versions.
There is an issue with an anime called saki https://www.crunchyroll.com/saki
the first season is 1920x1072 not 1920x1080 so I added these
elif str(resolution).lower() in ['1072p', '1072', 'fhd']:
info_url = "http://www.crunchyroll.com/xml/?req=RpcApiVideoPlayer_GetStandardConfig&media_id=%s&video_format=106&video_quality=62¤t_page=%s" % (
video_id, url)
resolution_to_find = "1920x1072"
but I saw your message:
Trying to login...
Traceback (most recent call last):
File "D:\anime-dl\anime_dl\__main__.py", line 18, in <module>
class main():
File "D:\anime-dl\anime_dl\__main__.py", line 75, in main
logger=logger, episode_range=args.range)
File "D:\anime-dl\anime_dl\AnimeDL.py", line 30, in __init__
skipper=skipper, logger=logger, episode_range=episode_range)
File "D:\anime-dl\anime_dl\sites\crunchyroll.py", line 68, in __init__
cookies, Token = self.webpagedownloader(url=url, username=username[0], password=password[0], country=Crunchy_Language)
File "D:\anime-dl\anime_dl\sites\crunchyroll.py", line 135, in webpagedownloader
if self.login_check(htmlsource=login_post.text.encode('utf-8')):
File "D:\anime-dl\anime_dl\sites\crunchyroll.py", line 80, in login_check
if '<a href="/logout"' in htmlsource:
TypeError: a bytes-like object is required, not 'str'
I downloaded @Nicnl fork of this project.
anyone have any idea about this issue?
I tried to fix this by converting htmlsource from byte to string, but the broke the download process, so I will leave it for people who understand python.
Check the latest binary now.
So which version of Python should we be using, the ReadMe just says Python 3
It should work on both. When I had started this project, Python 2 was the choice. But, then I had made changes that would make this work on both, Python 3 and Python 2.
I'll try to re-write things by next week and see if it's any better.
Thanks @Xonshiz for the work on this
Still getting error running on Windows PowerShell with Python 3.7.4 with latest code
PS C:\anime-dl\anime-dl-master\anime_dl> python __main__.py -v -i https://www.crunchyroll.com/en/full-metal-panic -u username -p password
Trying to login...
Traceback (most recent call last):
File "__main__.py", line 22, in <module>
class Main():
File "__main__.py", line 79, in Main
logger=logger, episode_range=args.range)
File "C:\anime-dl\anime-dl-master\anime_dl\Anime_dl.py", line 30, in __init__
skipper=skipper, logger=logger, episode_range=episode_range)
File "C:\anime-dl\anime-dl-master\anime_dl\sites\crunchyroll.py", line 36, in __init__
country=crunchy_language)
File "C:\anime-dl\anime-dl-master\anime_dl\common\browser_instance.py", line 76, in login_crunchyroll
login_check_response, login_cookies = login_check(html_source=login_post.text.encode('utf-8'), cookies=login_post.cookies)
File "C:\anime-dl\anime-dl-master\anime_dl\common\browser_instance.py", line 92, in login_check
if "href=\"/logout\"" in html_source:
TypeError: a bytes-like object is required, not 'str'
PS C:\anime-dl\anime-dl-master\anime_dl> python --version
Python 3.7.4