From 5f4d4e0499ab679a8c6c0de9410bbf208c59eaba Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 7 Sep 2018 13:49:45 -0700 Subject: single comment retrieval function, remove left-over debug writing --- youtube/comments.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'youtube') diff --git a/youtube/comments.py b/youtube/comments.py index 16c90a4..5bfcdbd 100644 --- a/youtube/comments.py +++ b/youtube/comments.py @@ -128,10 +128,17 @@ def request_comments(ctoken, replies=False): print("got , retrying") continue break - with open('debug/comments_debug', 'wb') as f: - f.write(content) + '''with open('debug/comments_debug', 'wb') as f: + f.write(content)''' return content +def single_comment_ctoken(video_id, comment_id): + page_params = proto.string(2, video_id) + proto.string(6, proto.percent_b64encode(proto.string(15, comment_id))) + + result = proto.nested(2, page_params) + proto.uint(3,6) + return base64.urlsafe_b64encode(result).decode('ascii') + + def parse_comments_ajax(content, replies=False): try: content = json.loads(uppercase_escape(content.decode('utf-8'))) -- cgit v1.2.3