aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/accounts.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-12-26 18:45:50 -0800
committerJames Taylor <user234683@users.noreply.github.com>2018-12-26 18:45:50 -0800
commitdfbd7778d10c15cf2e12e9007beba5458a3f3ab1 (patch)
tree20ed77ec95d86e1721850b43edabb5b2e6515ec7 /youtube/accounts.py
parent9a386145ff5db24eed5ca93977463e4885434104 (diff)
downloadyt-local-dfbd7778d10c15cf2e12e9007beba5458a3f3ab1.tar.lz
yt-local-dfbd7778d10c15cf2e12e9007beba5458a3f3ab1.tar.xz
yt-local-dfbd7778d10c15cf2e12e9007beba5458a3f3ab1.zip
Make accounts.txt more human-readable
Diffstat (limited to 'youtube/accounts.py')
-rw-r--r--youtube/accounts.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/youtube/accounts.py b/youtube/accounts.py
index e7d3ea5..bc0e017 100644
--- a/youtube/accounts.py
+++ b/youtube/accounts.py
@@ -19,7 +19,7 @@ except FileNotFoundError:
def save_accounts():
to_save = {username: account for username, account in accounts.items() if account['save']}
with open(os.path.join(settings.data_dir, 'accounts.txt'), 'w', encoding='utf-8') as f:
- f.write(json.dumps(to_save))
+ f.write(json.dumps(to_save, indent=4))
def add_account(username, password, save):
cookiejar = http.cookiejar.LWPCookieJar()
@@ -27,7 +27,7 @@ def add_account(username, password, save):
if successful:
accounts[username] = {
"save":save,
- "cookies":cookiejar.as_lwp_str(ignore_discard=False, ignore_expires=False),
+ "cookies":cookiejar.as_lwp_str(ignore_discard=False, ignore_expires=False).split('\n'),
}
if save:
save_accounts()
@@ -41,7 +41,7 @@ def cookiejar_from_lwp_str(lwp_str):
return cookiejar
def account_cookiejar(username):
- return cookiejar_from_lwp_str(accounts[username]['cookies'])
+ return cookiejar_from_lwp_str('\n'.join(accounts[username]['cookies']))
def get_account_login_page(query_string):
style = '''