aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-09-07 13:49:45 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-09-07 13:49:45 -0700
commit5f4d4e0499ab679a8c6c0de9410bbf208c59eaba (patch)
tree51e3d58d24da285f4b6e067905bb1317e676b743
parente31fd6028693ed1dce3f92540c6b410cbb0eefc1 (diff)
downloadyt-local-5f4d4e0499ab679a8c6c0de9410bbf208c59eaba.tar.lz
yt-local-5f4d4e0499ab679a8c6c0de9410bbf208c59eaba.tar.xz
yt-local-5f4d4e0499ab679a8c6c0de9410bbf208c59eaba.zip
single comment retrieval function, remove left-over debug writing
-rw-r--r--youtube/comments.py11
1 files changed, 9 insertions, 2 deletions
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 <!DOCTYPE>, 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')))