Xonshiz / anime-dl

Anime-dl is a command-line program to download anime from CrunchyRoll and Funimation.
MIT License
229 stars 37 forks source link

TypeError: a bytes-like object is required, not 'str' #116

Open bluephx4 opened 4 years ago

bluephx4 commented 4 years ago

I am able to download individual shows but when it comes to full series it throws an error.

C:\Users\mkark\Documents\Python\ffmpeg-4.2.2-win64-static\bin>main.py -i "https://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying" -u "$USERNAME" -p "$PASSWORD" -r "1080p" Trying to login... Logged in successfully... Traceback (most recent call last): File "C:\Users\mkark\Documents\Python\anime-dl-master\anime_dl__main.py", line 22, in class Main(): File "C:\Users\mkark\Documents\Python\anime-dl-master\anime_dl__main__.py", line 82, in Main logger=logger, episode_range=args.range, output=args.output) File "C:\Users\mkark\Documents\Python\anime-dl-master\anime_dl\Anime_dl.py", line 30, in init__ skipper=skipper, logger=logger, episode_range=episode_range, output=output) File "C:\Users\mkark\Documents\Python\anime-dl-master\anime_dl\sites\crunchyroll.py", line 44, in init self.whole_show(url=url, cookie=cookies, token=token, language=language, resolution=resolution, skipper=skipper, episode_range=episode_range, output=output) File "C:\Users\mkark\Documents\Python\anime-dl-master\anime_dl\sites\crunchyroll.py", line 127, in whole_show dub_list, ep_sub_list = self.episode_list_extractor(page_source=page_source, url=url) File "C:\Users\mkark\Documents\Python\anime-dl-master\anime_dl\sites\crunchyroll.py", line 185, in episode_list_extractor if "(Dub)" in u' '.join(title_value).encode('utf-8').strip(): TypeError: a bytes-like object is required, not 'str'

Error Log

DEBUG: You have successfully set the Debugging On. DEBUG: Arguments Provided : Namespace(input=['https://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying'], language='Japanese', output=None, password=['$PASWWORD'], range='All', resolution=['1080p'], skip=False, username=['$USERNAME'], verbose=True, version=False) DEBUG: Operating System : Windows - 10 - 10.0.18362 DEBUG: Python Version : 3.7.5 (64bit) DEBUG: Starting new HTTPS connection (1): www.crunchyroll.com:443 DEBUG: https://www.crunchyroll.com:443 "GET /login HTTP/1.1" 200 None DEBUG: https://www.crunchyroll.com:443 "POST /login HTTP/1.1" 302 None DEBUG: https://www.crunchyroll.com:443 "GET / HTTP/1.1" 200 None DEBUG: Starting new HTTPS connection (1): www.crunchyroll.com:443 DEBUG: https://www.crunchyroll.com:443 "GET /i-cant-understand-what-my-husband-is-saying HTTP/1.1" 200 None

bluephx4 commented 4 years ago

Found resolution in another issue. Issue #109

Epic Unknown statement { I sure did! It's a very simple fix and I apologize for not posting about it earlier. So the script SHOULD check if "title_value" is a byte like object or a regular string.

Because it is needed to be a byte like object for the anime you are downloading, simply make "(Dub)" now b'Dub' and yes that b needs to be in front of the single quotes, not inside.

Quick Edit: Line 185 of crunchyroll.py inside the sites folder ;) sorry

Happy coding and let me know if it fixes it for you! :) }

After changing that the script runs.