diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-12-26 17:24:53 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-12-26 17:24:53 -0800 |
commit | 6a23df8c90cd3def49f83a68b501f785eefc6b37 (patch) | |
tree | 4e6eabc8fb964fc6fccf4947d8b5bbe9766debaa /youtube/accounts.py | |
parent | b321b5fc6484c38d861530e6b89405b062e32459 (diff) | |
download | yt-local-6a23df8c90cd3def49f83a68b501f785eefc6b37.tar.lz yt-local-6a23df8c90cd3def49f83a68b501f785eefc6b37.tar.xz yt-local-6a23df8c90cd3def49f83a68b501f785eefc6b37.zip |
Don't use tor when logging in
Diffstat (limited to 'youtube/accounts.py')
-rw-r--r-- | youtube/accounts.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/youtube/accounts.py b/youtube/accounts.py index 9696899..f9bbc75 100644 --- a/youtube/accounts.py +++ b/youtube/accounts.py @@ -180,7 +180,8 @@ def _login(username, password, cookie_jar): Taken from youtube-dl """ - login_page = common.fetch_url(_LOGIN_URL, yt_dl_headers, report_text='Downloaded login page', cookie_jar_receive=cookie_jar).decode('utf-8') + + login_page = common.fetch_url(_LOGIN_URL, yt_dl_headers, report_text='Downloaded login page', cookie_jar_receive=cookie_jar, use_tor=False).decode('utf-8') '''with open('debug/login_page', 'w', encoding='utf-8') as f: f.write(login_page)''' #print(cookie_jar.as_lwp_str()) @@ -206,7 +207,7 @@ def _login(username, password, cookie_jar): 'Google-Accounts-XSRF': 1, } headers.update(yt_dl_headers) - result = common.fetch_url(url, headers, report_text=note, data=data, cookie_jar_send=cookie_jar, cookie_jar_receive=cookie_jar).decode('utf-8') + result = common.fetch_url(url, headers, report_text=note, data=data, cookie_jar_send=cookie_jar, cookie_jar_receive=cookie_jar, use_tor=False).decode('utf-8') #print(cookie_jar.as_lwp_str()) '''with open('debug/' + note, 'w', encoding='utf-8') as f: f.write(result)''' @@ -338,10 +339,13 @@ def _login(username, password, cookie_jar): return False try: - check_cookie_results = common.fetch_url(check_cookie_url, headers=yt_dl_headers, report_text="Checked cookie", cookie_jar_send=cookie_jar, cookie_jar_receive=cookie_jar).decode('utf-8') + check_cookie_results = common.fetch_url(check_cookie_url, headers=yt_dl_headers, report_text="Checked cookie", cookie_jar_send=cookie_jar, cookie_jar_receive=cookie_jar, use_tor=False).decode('utf-8') except (urllib.error.URLError, compat_http_client.HTTPException, socket.error) as err: return False + '''with open('debug/check_cookie_results', 'w', encoding='utf-8') as f: + f.write(check_cookie_results)''' + if 'https://myaccount.google.com/' not in check_cookie_results: warn('Unable to log in') return False |