From a5286e57cc467ef2de3d0235f9571b292a083874 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Wed, 26 Dec 2018 20:14:33 -0800 Subject: Fix post_comment function --- youtube/post_comment.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/youtube/post_comment.py b/youtube/post_comment.py index 2c9410c..57e9e2e 100644 --- a/youtube/post_comment.py +++ b/youtube/post_comment.py @@ -94,7 +94,7 @@ def delete_comment(video_id, comment_id, author_id, session_token, cookiejar): xsrf_token_regex = re.compile(r'''XSRF_TOKEN"\s*:\s*"([\w-]*(?:=|%3D){0,2})"''') def post_comment(parameters, fields): - username = parameters['username'] + username = fields['username'][0] cookiejar = accounts.account_cookiejar(username) #parameters = urllib.parse.parse_qs(query_string) @@ -116,7 +116,7 @@ def post_comment(parameters, fields): raise Exception("Couldn't find xsrf_token") if 'parent_id' in parameters: - code = _post_comment_reply(fields['comment_text'][0], parameters['video_id'][0], parameters['parent_id'][0], token, cookie_data) + code = _post_comment_reply(fields['comment_text'][0], parameters['video_id'][0], parameters['parent_id'][0], token, cookiejar) '''try: response = comments.get_comments_page(query_string) except socket.error as e: @@ -127,7 +127,7 @@ def post_comment(parameters, fields): return b'Refreshing comment page yielded error 500 Internal Server Error.\nPost comment status code: ' + code.encode('ascii') return response''' else: - code = _post_comment(fields['comment_text'][0], fields['video_id'][0], token, cookie_data) + code = _post_comment(fields['comment_text'][0], fields['video_id'][0], token, cookiejar) '''try: response = comments.get_comments_page('ctoken=' + comments.make_comment_ctoken(video_id, sort=1)) -- cgit v1.2.3