diff --git a/Changelog.md b/Changelog.md index 77e5330..0727fc1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -33,4 +33,5 @@ - Login Issue Fixed [2019.05.16] - Re-structured the code for better maintainance and re-usability. [2019.05.16] - Fixed #100 [2019.05.26] -- Fixed #99 [2019.05.26] \ No newline at end of file +- Fixed #99 [2019.05.26] +- Fixed cookie issue that prevented downloading of HD and FHD streams [2019.05.27] \ No newline at end of file diff --git a/anime_dl/common/browser_instance.py b/anime_dl/common/browser_instance.py index da1607d..e6c7501 100644 --- a/anime_dl/common/browser_instance.py +++ b/anime_dl/common/browser_instance.py @@ -9,6 +9,7 @@ import re def page_downloader(url, scrapper_delay=5, **kwargs): headers = kwargs.get("headers") + received_cookies = kwargs.get("cookies") if not headers: headers = { 'User-Agent': @@ -19,7 +20,7 @@ def page_downloader(url, scrapper_delay=5, **kwargs): sess = session() sess = create_scraper(sess, delay=scrapper_delay) - connection = sess.get(url, headers=headers, cookies=kwargs.get("cookies")) + connection = sess.get(url, headers=headers, cookies=received_cookies) if connection.status_code != 200: print("Whoops! Seems like I can't connect to website.") @@ -31,7 +32,7 @@ def page_downloader(url, scrapper_delay=5, **kwargs): page_source = BeautifulSoup(connection.text.encode("utf-8"), "html.parser") connection_cookies = sess.cookies - return True, page_source, connection_cookies + return True, page_source, received_cookies def login_crunchyroll(url, username, password, country): @@ -75,7 +76,7 @@ def login_crunchyroll(url, username, password, country): login_check_response, login_cookies = login_check(html_source=login_post.text.encode('utf-8'), cookies=login_post.cookies) if login_check_response: print("Logged in successfully...") - return True, login_cookies, csrf_token + return True, initial_cookies, csrf_token else: print("Unable to Log you in. Check credentials again.") return False, None, None diff --git a/anime_dl/sites/crunchyroll.py b/anime_dl/sites/crunchyroll.py index ddeacac..fce0158 100644 --- a/anime_dl/sites/crunchyroll.py +++ b/anime_dl/sites/crunchyroll.py @@ -77,7 +77,7 @@ class Crunchyroll(object): subs_downloaded = supporters.sub_fetcher.crunchyroll_subs(xml=str(xml_page_connect), episode_number=episode_number, file_name=file_name) if not subs_downloaded: pass - m3u8_downloaded = self.m3u8_downloader(url=m3u8_file_link, cookies=xml_cookies, resolution_to_find=resolution_to_find, file_name=file_name) + m3u8_downloaded = self.m3u8_downloader(url=m3u8_file_link, cookies=cookies, resolution_to_find=resolution_to_find, file_name=file_name) if m3u8_downloaded: sub_files = self.sub_prepare() font_files = [os.path.realpath(font_file) for font_file in diff --git a/docs/Changelog.md b/docs/Changelog.md index 77e5330..461522a 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -33,4 +33,5 @@ - Login Issue Fixed [2019.05.16] - Re-structured the code for better maintainance and re-usability. [2019.05.16] - Fixed #100 [2019.05.26] -- Fixed #99 [2019.05.26] \ No newline at end of file +- Fixed #99 [2019.05.26] +- Fixed cookie issue that prevented downloading of HD and FHD streams [2019.05.27 \ No newline at end of file