diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-12-26 20:16:14 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-12-26 20:16:14 -0800 |
commit | a9c1e804ed936f34e551333f62e165cf2e20b50c (patch) | |
tree | f13e7b7bf0d370e781a308059bd210a491a6df51 | |
parent | a5286e57cc467ef2de3d0235f9571b292a083874 (diff) | |
download | yt-local-a9c1e804ed936f34e551333f62e165cf2e20b50c.tar.lz yt-local-a9c1e804ed936f34e551333f62e165cf2e20b50c.tar.xz yt-local-a9c1e804ed936f34e551333f62e165cf2e20b50c.zip |
post_comment: receive cookies given during session token retrieval (fixes 400 bad request when comment is posted)
-rw-r--r-- | youtube/post_comment.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/youtube/post_comment.py b/youtube/post_comment.py index 57e9e2e..baa2ff9 100644 --- a/youtube/post_comment.py +++ b/youtube/post_comment.py @@ -108,7 +108,7 @@ def post_comment(parameters, fields): # Tokens retrieved from disable_polymer pages only work with that format. Tokens retrieved on mobile only work using mobile requests # Additionally, tokens retrieved without sending the same cookie won't work. So this is necessary even if the bgr and stuff was reverse engineered. headers = {'User-Agent': common.mobile_user_agent} - mobile_page = common.fetch_url('https://m.youtube.com/watch?v=' + video_id, headers, report_text="Retrieved session token for comment", cookiejar_send=cookiejar).decode() + mobile_page = common.fetch_url('https://m.youtube.com/watch?v=' + video_id, headers, report_text="Retrieved session token for comment", cookiejar_send=cookiejar, cookiejar_receive=cookiejar).decode() match = xsrf_token_regex.search(mobile_page) if match: token = match.group(1).replace("%3D", "=") |