diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-06-20 14:08:32 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-06-20 14:08:32 +0530 |
commit | dfb855b42da32807ffac243f1e763f480c4d44ba (patch) | |
tree | 63c731a682f05dfcf8f61e67d32b01568f62e370 /yt_dlp/extractor/bilibili.py | |
parent | 5df14442552038d7344162b21f97dd510fe2ffd6 (diff) | |
download | hypervideo-pre-dfb855b42da32807ffac243f1e763f480c4d44ba.tar.lz hypervideo-pre-dfb855b42da32807ffac243f1e763f480c4d44ba.tar.xz hypervideo-pre-dfb855b42da32807ffac243f1e763f480c4d44ba.zip |
[extractor/BiliIntl] Fix subtitle extraction
Closes #3123
Authored by: HobbyistDev
Diffstat (limited to 'yt_dlp/extractor/bilibili.py')
-rw-r--r-- | yt_dlp/extractor/bilibili.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/yt_dlp/extractor/bilibili.py b/yt_dlp/extractor/bilibili.py index 6879ca2e7..d695d9b49 100644 --- a/yt_dlp/extractor/bilibili.py +++ b/yt_dlp/extractor/bilibili.py @@ -789,7 +789,8 @@ class BiliIntlBaseIE(InfoExtractor): def json2srt(self, json): data = '\n\n'.join( f'{i + 1}\n{srt_subtitles_timecode(line["from"])} --> {srt_subtitles_timecode(line["to"])}\n{line["content"]}' - for i, line in enumerate(json['body']) if line.get('content')) + for i, line in enumerate(traverse_obj(json, ( + 'body', lambda _, l: l['content'] and l['from'] and l['to'])))) return data def _get_subtitles(self, *, ep_id=None, aid=None): |