Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python covert vtt subtittle to text txt file

import re
bad_words = ['-->','</c>'] 


with open('example.en.vtt') as oldfile, open('newfile.txt', 'w') as newfile:
    for line in oldfile:
        if not any(bad_word in line for bad_word in bad_words):
            newfile.write(line)


with open('newfile.txt') as result:
    uniqlines = set(result.readlines())
    with open('sub_out.txt', 'w') as rmdup:
        mylst = map(lambda each: each.strip(">>"), uniqlines)
        print(mylst)
        rmdup.writelines(set(mylst))
Source by # #
 
PREVIOUS NEXT
Tagged: #python #covert #vtt #subtittle #text #txt #file
ADD COMMENT
Topic
Name
9+3 =