Cookie Issue fixed.

- Fixed cookie issue that prevented downloading of HD and FHD streams [2019.05.27
master
Xonshiz 2019-05-27 16:51:51 +05:30
parent d3e4eca64c
commit 77fa272842
4 changed files with 9 additions and 6 deletions

View File

@ -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]
- Fixed #99 [2019.05.26]
- Fixed cookie issue that prevented downloading of HD and FHD streams [2019.05.27]

View File

@ -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

View File

@ -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

View File

@ -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]
- Fixed #99 [2019.05.26]
- Fixed cookie issue that prevented downloading of HD and FHD streams [2019.05.27