diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-09-29 21:54:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-29 21:54:39 +0800 |
commit | 0ce26ef22834587920bd06f3cb32dab4fcef3c2a (patch) | |
tree | 4ad4067b006e8648a431178fbe36285a20a27b8c /youtube_dl | |
parent | 0d72ff9c51ecc84aae1717c05f8b73ad94199687 (diff) | |
parent | a56e74e2713ed45f4096735cf49d1d97b5e75389 (diff) |
Merge pull request #10788 from TRox1972/instagram_comments
[Instagram] Extract comments
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/instagram.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube_dl/extractor/instagram.py b/youtube_dl/extractor/instagram.py index 8f7f232be..5ebc30a10 100644 --- a/youtube_dl/extractor/instagram.py +++ b/youtube_dl/extractor/instagram.py @@ -29,6 +29,7 @@ class InstagramIE(InfoExtractor): 'uploader': 'Naomi Leonor Phan-Quang', 'like_count': int, 'comment_count': int, + 'comments': list, }, }, { # missing description @@ -44,6 +45,7 @@ class InstagramIE(InfoExtractor): 'uploader': 'Britney Spears', 'like_count': int, 'comment_count': int, + 'comments': list, }, 'params': { 'skip_download': True, @@ -101,6 +103,14 @@ class InstagramIE(InfoExtractor): uploader_id = media.get('owner', {}).get('username') like_count = int_or_none(media.get('likes', {}).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: video_url = self._og_search_video_url(webpage, secure=False) @@ -131,6 +141,7 @@ class InstagramIE(InfoExtractor): 'uploader': uploader, 'like_count': like_count, 'comment_count': comment_count, + 'comments': comments, } |