diff options
author | pukkandan <pukkandan@gmail.com> | 2021-02-28 20:26:08 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 20:26:08 +0530 |
commit | 277d6ff5f2bd4f142429def30d01df264eb7c922 (patch) | |
tree | 1ffa4fe83c33aef1f82e1e339cc59c46139ca0ac /yt_dlp/extractor/bilibili.py | |
parent | 1cf376f55a3d9335eb161c07c439ca143d86924e (diff) | |
download | hypervideo-pre-277d6ff5f2bd4f142429def30d01df264eb7c922.tar.lz hypervideo-pre-277d6ff5f2bd4f142429def30d01df264eb7c922.tar.xz hypervideo-pre-277d6ff5f2bd4f142429def30d01df264eb7c922.zip |
Extract comments only when needed #95 (Closes #94)
Diffstat (limited to 'yt_dlp/extractor/bilibili.py')
-rw-r--r-- | yt_dlp/extractor/bilibili.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index be117a2bb..764ac4d3c 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -255,10 +255,6 @@ class BiliBiliIE(InfoExtractor): info['uploader'] = self._html_search_meta( 'author', webpage, 'uploader', default=None) - comments = None - if self._downloader.params.get('getcomments', False): - comments = self._get_all_comment_pages(video_id) - raw_danmaku = self._get_raw_danmaku(video_id, cid) raw_tags = self._get_tags(video_id) @@ -266,11 +262,18 @@ class BiliBiliIE(InfoExtractor): top_level_info = { 'raw_danmaku': raw_danmaku, - 'comments': comments, - 'comment_count': len(comments) if comments is not None else None, 'tags': tags, 'raw_tags': raw_tags, } + if self._downloader.params.get('getcomments', False): + def get_comments(): + comments = self._get_all_comment_pages(video_id) + return { + 'comments': comments, + 'comment_count': len(comments) + } + + top_level_info['__post_extractor'] = get_comments ''' # Requires https://github.com/m13253/danmaku2ass which is licenced under GPL3 |