mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 08:36:28 +01:00
[Instagram] Extract comments
This commit is contained in:
parent
45cae3b021
commit
a56e74e271
@ -29,6 +29,7 @@ class InstagramIE(InfoExtractor):
|
|||||||
'uploader': 'Naomi Leonor Phan-Quang',
|
'uploader': 'Naomi Leonor Phan-Quang',
|
||||||
'like_count': int,
|
'like_count': int,
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
|
'comments': list,
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
# missing description
|
# missing description
|
||||||
@ -44,6 +45,7 @@ class InstagramIE(InfoExtractor):
|
|||||||
'uploader': 'Britney Spears',
|
'uploader': 'Britney Spears',
|
||||||
'like_count': int,
|
'like_count': int,
|
||||||
'comment_count': int,
|
'comment_count': int,
|
||||||
|
'comments': list,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -101,6 +103,14 @@ class InstagramIE(InfoExtractor):
|
|||||||
uploader_id = media.get('owner', {}).get('username')
|
uploader_id = media.get('owner', {}).get('username')
|
||||||
like_count = int_or_none(media.get('likes', {}).get('count'))
|
like_count = int_or_none(media.get('likes', {}).get('count'))
|
||||||
comment_count = int_or_none(media.get('comments', {}).get('count'))
|
comment_count = int_or_none(media.get('comments', {}).get('count'))
|
||||||
|
comments = [{
|
||||||
|
'author': comment.get('user', {}).get('username'),
|
||||||
|
'author_id': comment.get('user', {}).get('id'),
|
||||||
|
'id': comment.get('id'),
|
||||||
|
'text': comment.get('text'),
|
||||||
|
'timestamp': int_or_none(comment.get('created_at')),
|
||||||
|
} for comment in media.get('comments', {}).get('nodes', [])
|
||||||
|
if comment.get('text')]
|
||||||
|
|
||||||
if not video_url:
|
if not video_url:
|
||||||
video_url = self._og_search_video_url(webpage, secure=False)
|
video_url = self._og_search_video_url(webpage, secure=False)
|
||||||
@ -131,6 +141,7 @@ class InstagramIE(InfoExtractor):
|
|||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
'comment_count': comment_count,
|
'comment_count': comment_count,
|
||||||
|
'comments': comments,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user