mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[crunchyroll] Use enumerate
This commit is contained in:
parent
1d430674c7
commit
d0a72674c6
1 changed files with 2 additions and 4 deletions
|
@ -86,9 +86,8 @@ def next_value(self):
|
|||
return zlib.decompress(decrypted_data)
|
||||
|
||||
def _convert_subtitles_to_srt(self, subtitles):
|
||||
i = 1
|
||||
output = ''
|
||||
for start, end, text in re.findall(r'<event [^>]*?start="([^"]+)" [^>]*?end="([^"]+)" [^>]*?text="([^"]+)"[^>]*?>', subtitles):
|
||||
for i, (start, end, text) in enumerate(re.findall(r'<event [^>]*?start="([^"]+)" [^>]*?end="([^"]+)" [^>]*?text="([^"]+)"[^>]*?>', subtitles), 1):
|
||||
start = start.replace('.', ',')
|
||||
end = end.replace('.', ',')
|
||||
text = clean_html(text)
|
||||
|
@ -96,7 +95,6 @@ def _convert_subtitles_to_srt(self, subtitles):
|
|||
if not text:
|
||||
continue
|
||||
output += '%d\n%s --> %s\n%s\n\n' % (i, start, end, text)
|
||||
i += 1
|
||||
return output
|
||||
|
||||
def _real_extract(self,url):
|
||||
|
@ -187,4 +185,4 @@ def _real_extract(self,url):
|
|||
'upload_date': video_upload_date,
|
||||
'subtitles': subtitles,
|
||||
'formats': formats,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue