aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/accounts.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-12-24 23:50:39 -0800
committerJames Taylor <user234683@users.noreply.github.com>2018-12-24 23:50:39 -0800
commitdda06bd860b735b185efa45ba55cad8f52b650f7 (patch)
tree419741fc0b4e9d4b5308ffd81c6d47f7114eebaa /youtube/accounts.py
parent3d1a1189e7b23b696a76352ddb564475e41c7292 (diff)
downloadyt-local-dda06bd860b735b185efa45ba55cad8f52b650f7.tar.lz
yt-local-dda06bd860b735b185efa45ba55cad8f52b650f7.tar.xz
yt-local-dda06bd860b735b185efa45ba55cad8f52b650f7.zip
add_account function
Diffstat (limited to 'youtube/accounts.py')
-rw-r--r--youtube/accounts.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/youtube/accounts.py b/youtube/accounts.py
index a1865c0..db33496 100644
--- a/youtube/accounts.py
+++ b/youtube/accounts.py
@@ -20,6 +20,16 @@ def save_accounts():
with open(os.path.join(settings.data_dir, 'accounts.txt'), 'w', encoding='utf-8') as f:
f.write(json.dumps(to_save))
+def add_account(username, password, save):
+ cookie_jar = http.cookiejar.LWPCookieJar()
+ _login(username, password, cookie_jar)
+ accounts.append({
+ "username": username,
+ "save":save,
+ "cookies":cookie_jar.as_lwp_str(ignore_discard=False, ignore_expires=False),
+ })
+
+
# ---------------------------------
# Code ported from youtube-dl
# ---------------------------------