aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/comments.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-12-19 15:50:19 -0800
committerJames Taylor <user234683@users.noreply.github.com>2019-12-19 15:50:19 -0800
commitbeb0976b5bc09a053d027a6e7020bb3a83f4aca1 (patch)
tree3208aaa71a26457ee17cdb580de464aa108377f9 /youtube/comments.py
parent02848a1a3213bb4ad872865768a7b97f663a24ed (diff)
downloadyt-local-beb0976b5bc09a053d027a6e7020bb3a83f4aca1.tar.lz
yt-local-beb0976b5bc09a053d027a6e7020bb3a83f4aca1.tar.xz
yt-local-beb0976b5bc09a053d027a6e7020bb3a83f4aca1.zip
Extraction: Rewrite comment extraction, remove author_id and rename author_channel_id to that, fix bug in extract_items
author_id (an internal sql-like integer previously required for deleting and editing comments) has been removed by Youtube and is no longer required. Remove it for simplicity. Rename author_channel_id to author_id for consistency with other extraction attributes. extract_items returned None for items instead of [] for empty continuation responses. Fixes that.
Diffstat (limited to 'youtube/comments.py')
-rw-r--r--youtube/comments.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/youtube/comments.py b/youtube/comments.py
index e237f0f..4e79d8b 100644
--- a/youtube/comments.py
+++ b/youtube/comments.py
@@ -93,11 +93,10 @@ def post_process_comments_info(comments_info):
comment['permalink'] = util.URL_ORIGIN + '/watch?v=' + comments_info['video_id'] + '&lc=' + comment['id']
- if comment['author_channel_id'] in accounts.accounts:
+ if comment['author_id'] in accounts.accounts:
comment['delete_url'] = (util.URL_ORIGIN + '/delete_comment?video_id='
+ comments_info['video_id']
- + '&channel_id='+ comment['author_channel_id']
- + '&author_id=' + comment['author_id']
+ + '&channel_id='+ comment['author_id']
+ '&comment_id=' + comment['id'])
reply_count = comment['reply_count']
@@ -135,7 +134,7 @@ def post_process_comments_info(comments_info):
def video_comments(video_id, sort=0, offset=0, lc='', secret_key=''):
if settings.comments_mode:
- comments_info = yt_data_extract.parse_comments_polymer(request_comments(make_comment_ctoken(video_id, sort, offset, lc, secret_key)))
+ comments_info = yt_data_extract.extract_comments_info(request_comments(make_comment_ctoken(video_id, sort, offset, lc, secret_key)))
post_process_comments_info(comments_info)
post_comment_url = util.URL_ORIGIN + "/post_comment?video_id=" + video_id
@@ -160,7 +159,7 @@ def get_comments_page():
ctoken = comment_replies_ctoken(video_id, parent_id)
replies = True
- comments_info = yt_data_extract.parse_comments_polymer(request_comments(ctoken, replies))
+ comments_info = yt_data_extract.extract_comments_info(request_comments(ctoken, replies))
post_process_comments_info(comments_info)
if not replies: