isaacbernat / netflix-to-srt

Rip, extract and convert subtitles to .srt closed captions from .xml/dfxp/ttml and .vtt/WebVTT (e.g. Netflix, YouTube)
MIT License
749 stars 72 forks source link

Raises exception for vtt file: ".vtt format must start with WEBVTT, wrong file?" #31

Closed llbaker302 closed 4 years ago

llbaker302 commented 4 years ago

Tested on subtitle file attached, even though the file starts with "WEBVTT" it still throws the exception on line 70.

Vikings S04E01.zip

llbaker302 commented 4 years ago

Disabling line 69/70 it converts it, but there's an extra blank line added to the end which makes the .srt unreadable e.g.

339 00:46:08,182 --> 00:46:11,185 Sous-titres : Anne-Pierre Hocquet

340

Has vtt_to_srt() been tested?

llbaker302 commented 4 years ago

Downloaded a whole batch of subtitles using chrome developer tools and the string at the start is always: \ufeffWEBVTT changing this as the check on line 69 works for every file.

I also removed lines.append("\n".join(current_sub_line)) on line 83 and the issue of adding a blank line at the end is fixed.

isaacbernat commented 4 years ago

@kewickviper thanks for reporting the bug and finding a fix. Do you want to create a Pull Request with or would you prefer if I did?

llbaker302 commented 4 years ago

No worries have created pull request.