mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 21:33:19 +00:00
use get_first() and remove .get()
This commit is contained in:
parent
6f5c669fcc
commit
f6ced29596
|
@ -3308,9 +3308,11 @@ def _extract_heatmap(self, data):
|
|||
})) or None
|
||||
|
||||
def _extract_comment(self, view_model, entities, parent=None):
|
||||
comment_entity_payload = traverse_obj(entities, (..., 'payload', 'commentEntityPayload', {dict}), get_all=False)
|
||||
toolbar_entity_payload = traverse_obj(entities, (..., 'payload', 'engagementToolbarStateEntityPayload', {dict}), get_all=False)
|
||||
comment_id = comment_entity_payload.get('properties').get('commentId')
|
||||
comment_entity_payload = get_first(entities, ('payload', 'commentEntityPayload', {dict}))
|
||||
toolbar_entity_payload = get_first(entities, ('payload', 'engagementToolbarStateEntityPayload', {dict})) or {}
|
||||
comment_id = traverse_obj(comment_entity_payload, ('properties', 'commentId', {str}))
|
||||
if not comment_id:
|
||||
return
|
||||
|
||||
info = {
|
||||
'id': comment_id,
|
||||
|
|
Loading…
Reference in a new issue