From 717bf210937c757595624348db9389969be9654f Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 10 Nov 2018 00:27:43 -0800 Subject: Can now store settings&data in ~/.youtube-local, keeping program files separate --- youtube/account_functions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'youtube/account_functions.py') diff --git a/youtube/account_functions.py b/youtube/account_functions.py index f34e5f2..0c7973b 100644 --- a/youtube/account_functions.py +++ b/youtube/account_functions.py @@ -5,6 +5,8 @@ import json from youtube import common, proto, comments import re import traceback +import settings +import os def _post_comment(text, video_id, session_token, cookie): headers = { @@ -103,7 +105,7 @@ def delete_comment(video_id, comment_id, author_id, session_token, cookie): xsrf_token_regex = re.compile(r'''XSRF_TOKEN"\s*:\s*"([\w-]*(?:=|%3D){0,2})"''') def post_comment(query_string, fields): - with open('data/cookie.txt', 'r', encoding='utf-8') as f: + with open(os.path.join(settings.data_dir, 'cookie.txt'), 'r', encoding='utf-8') as f: cookie_data = f.read() parameters = urllib.parse.parse_qs(query_string) -- cgit v1.2.3