aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
Diffstat (limited to 'youtube')
-rw-r--r--youtube/accounts.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/youtube/accounts.py b/youtube/accounts.py
index 312b711..e7d3ea5 100644
--- a/youtube/accounts.py
+++ b/youtube/accounts.py
@@ -23,12 +23,15 @@ def save_accounts():
def add_account(username, password, save):
cookiejar = http.cookiejar.LWPCookieJar()
- condition = _login(username, password, cookiejar)
- accounts[username] = {
- "save":save,
- "cookies":cookiejar.as_lwp_str(ignore_discard=False, ignore_expires=False),
- }
- return condition
+ successful = _login(username, password, cookiejar)
+ if successful:
+ accounts[username] = {
+ "save":save,
+ "cookies":cookiejar.as_lwp_str(ignore_discard=False, ignore_expires=False),
+ }
+ if save:
+ save_accounts()
+ return successful
def cookiejar_from_lwp_str(lwp_str):
cookiejar = http.cookiejar.LWPCookieJar()