mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 21:33:19 +00:00
use single traversal
This commit is contained in:
parent
f6ced29596
commit
8d428b42c0
|
@ -3316,12 +3316,14 @@ def _extract_comment(self, view_model, entities, parent=None):
|
|||
|
||||
info = {
|
||||
'id': comment_id,
|
||||
'text': try_get(comment_entity_payload, lambda x: x['properties']['content']['content'], str),
|
||||
'like_count': parse_count(try_get(comment_entity_payload, lambda x: x['toolbar']['likeCountA11y'], str)) or 0,
|
||||
'author_id': traverse_obj(comment_entity_payload, ('author', 'channelId', {self.ucid_or_none})),
|
||||
'author': try_get(comment_entity_payload, lambda x: x['author']['displayName'], str),
|
||||
'author_thumbnail': traverse_obj(comment_entity_payload, ('author', 'avatarThumbnailUrl', {url_or_none})),
|
||||
'parent': parent or 'root',
|
||||
**traverse_obj(comment_entity_payload, {
|
||||
'text': ('properties', 'content', 'content', {str}),
|
||||
'like_count': ('toolbar', 'likeCountA11y', {parse_count}),
|
||||
'author_id': ('author', 'channelId', {self.ucid_or_none}),
|
||||
'author': ('author', 'displayName', {str}),
|
||||
'author_thumbnail': ('author', 'avatarThumbnailUrl', {url_or_none}),
|
||||
}),
|
||||
}
|
||||
|
||||
# Timestamp is an estimate calculated from the current time and time_text
|
||||
|
|
Loading…
Reference in a new issue