Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/yt-dlp/yt-dlp into ytdlp
Browse files Browse the repository at this point in the history
* 'master' of https://github.com/yt-dlp/yt-dlp:
  [extractor/BiliIntl] Fix subtitle extraction
  • Loading branch information
Lesmiscore committed Jun 20, 2022
2 parents 835f66d + dfb855b commit 6a302cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion yt_dlp/extractor/bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ def _call_api(self, endpoint, *args, **kwargs):
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):
Expand Down

0 comments on commit 6a302cc

Please sign in to comment.