This commit is contained in:
Puyodead1 2022-01-12 19:55:30 -05:00
parent 884be3b68a
commit ea37e8a397
2 changed files with 5 additions and 3 deletions

3
.gitignore vendored
View File

@ -125,4 +125,5 @@ info.py
.idea/ .idea/
cookies.txt cookies.txt
selenium_test.py selenium_test.py
selenium_data/ selenium_data/
config.dev.toml

View File

@ -1,5 +1,6 @@
from webvtt import WebVTT from webvtt import WebVTT
import html, os import html
import os
from pysrt.srtitem import SubRipItem from pysrt.srtitem import SubRipItem
from pysrt.srttime import SubRipTime from pysrt.srttime import SubRipTime
@ -8,7 +9,7 @@ def convert(directory, filename):
index = 0 index = 0
vtt_filepath = os.path.join(directory, filename + ".vtt") vtt_filepath = os.path.join(directory, filename + ".vtt")
srt_filepath = os.path.join(directory, filename + ".srt") srt_filepath = os.path.join(directory, filename + ".srt")
srt = open(srt_filepath, "w") srt = open(srt_filepath, mode="w", errors="ignore")
for caption in WebVTT().read(vtt_filepath): for caption in WebVTT().read(vtt_filepath):
index += 1 index += 1