From fcb44c3052cebd5c4a68c90baf1ef83b2133ef3a Mon Sep 17 00:00:00 2001 From: Xonshiz Date: Sun, 21 Jan 2018 21:49:30 +0530 Subject: [PATCH] Fix For #31 Fixes #31 --- Changelog.md | 3 ++- anime_dl/__main__.py | 2 +- anime_dl/animeName.py | 1 + anime_dl/sites/crunchyroll.py | 21 +++++++++++++++++++-- docs/Changelog.md | 3 ++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index 6e742f0..7d74a8a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -24,4 +24,5 @@ - Fix for #17 and #22 [2017.12.27] - Fix for #17 and #26 [2017.12.27] - PEP8 Cleaning [2018.01.02] -- Fix for #18 [2018.01.02] \ No newline at end of file +- Fix for #18 [2018.01.02] +- Fix for #31 [2018.01.21] \ No newline at end of file diff --git a/anime_dl/__main__.py b/anime_dl/__main__.py index b71b782..7534175 100644 --- a/anime_dl/__main__.py +++ b/anime_dl/__main__.py @@ -70,6 +70,6 @@ class main(): if type(args.range) == list: args.range = args.range[0] - AnimeDL(url=args.input, username=str(args.username), password=str(args.password), + AnimeDL(url=args.input, username=args.username, password=args.password, resolution=args.resolution, language=args.language, skipper=skipper, logger=logger, episode_range=args.range) diff --git a/anime_dl/animeName.py b/anime_dl/animeName.py index 1e0c559..ae85f01 100644 --- a/anime_dl/animeName.py +++ b/anime_dl/animeName.py @@ -7,6 +7,7 @@ class animeName(object): def nameEdit(self, animeName, episodeNumber, resolution): + animeName = str(animeName).replace("039T", "'") rawName = str(animeName).title().strip().replace("Season ", "S") + " - " +\ str(episodeNumber).strip() + " [" + str(resolution) + "]" file_name = str(re.sub(r'[^A-Za-z0-9\ \-\' \\]+', '', str(animeName))).title().strip().replace("Season ", "S")\ diff --git a/anime_dl/sites/crunchyroll.py b/anime_dl/sites/crunchyroll.py index cfb166c..7d0927b 100644 --- a/anime_dl/sites/crunchyroll.py +++ b/anime_dl/sites/crunchyroll.py @@ -28,6 +28,10 @@ class CrunchyRoll(object): def __init__(self, url, password, username, resolution, language, skipper, logger, episode_range): + # print("Username : {0}".format(username)) + # print("Type Username : {0}".format(type(username))) + # print("Type Username : {0}".format(type(password))) + # print("Password : {0}".format(password)) if logger == "True": logging.basicConfig(format='%(levelname)s: %(message)s', filename="Error Log.log", level=logging.DEBUG, encoding="utf-8") @@ -96,6 +100,9 @@ def webpagedownloader(self, url, username, password): headers=headers, cookies=initial_cookies) + # with open("login_source.html", "w") as wf: + # wf.write(login_post.text.encode('utf-8')) + if self.login_check(htmlsource=login_post.text.encode('utf-8')): print("Logged in successfully...") resp = sess.get( @@ -349,6 +356,8 @@ def wholeShow(self, url, cookie, token, language, resolution, skipper, episode_r sess = requests.session() sess = cfscrape.create_scraper(sess) page_source = sess.get(url=url, headers=headers, cookies=cookie).text.encode("utf-8") + # with open("New_way.html", "w") as wf: + # wf.write(page_source) dub_list = [] ep_sub_list = [] @@ -396,7 +405,11 @@ def wholeShow(self, url, cookie, token, language, resolution, skipper, episode_r for episode_url in dub_list[::-1]: # cookies, Token = self.webpagedownloader(url=url) # print("Dub list : %s" % dub_list) - self.singleEpisode(url=episode_url, cookies=cookie, token=token, resolution=resolution) + try: + self.singleEpisode(url=episode_url, cookies=cookie, token=token, resolution=resolution) + except Exception as SomeError: + print("Error Downloading : {0}".format(SomeError)) + pass print("-----------------------------------------------------------") print("\n") else: @@ -405,7 +418,11 @@ def wholeShow(self, url, cookie, token, language, resolution, skipper, episode_r for episode_url in sub_list[::-1]: # cookies, Token = self.webpagedownloader(url=url) # print("Sub list : %s" % sub_list) - self.singleEpisode(url=episode_url, cookies=cookie, token=token, resolution=resolution) + try: + self.singleEpisode(url=episode_url, cookies=cookie, token=token, resolution=resolution) + except Exception as SomeError: + print("Error Downloading : {0}".format(SomeError)) + pass print("-----------------------------------------------------------") print("\n") diff --git a/docs/Changelog.md b/docs/Changelog.md index 6e742f0..7d74a8a 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -24,4 +24,5 @@ - Fix for #17 and #22 [2017.12.27] - Fix for #17 and #26 [2017.12.27] - PEP8 Cleaning [2018.01.02] -- Fix for #18 [2018.01.02] \ No newline at end of file +- Fix for #18 [2018.01.02] +- Fix for #31 [2018.01.21] \ No newline at end of file