File size: 396 Bytes
efaf91a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import ass
import os
import sys

SUB_NAME = sys.argv[1]

en_name = "Extracted - " + os.path.splitext(SUB_NAME)[0] + ".txt"

with open(SUB_NAME, "r", encoding='utf-8-sig') as f:
    doc = ass.parse(f)

en_file = open(en_name, "w")

for e in doc.events:
    if isinstance(e, ass.line.Dialogue) and e.style == '英':
        en_file.write(e.text.strip())
        en_file.write("\n")

en_file.close()