Skip to content

Instantly share code, notes, and snippets.

@underr
Created August 3, 2016 17:44
Show Gist options
  • Save underr/73434b10f18376489fe414c70644d432 to your computer and use it in GitHub Desktop.
Save underr/73434b10f18376489fe414c70644d432 to your computer and use it in GitHub Desktop.
tr*psubs
from yandex_translate import YandexTranslate
import os
progresso=0
translate = YandexTranslate('APIKEY')
with open('subs.srt') as f:
content = f.readlines()
tamanho=len(content)
saida = open('out.srt','w')
for line in content:
progresso=progresso+1
saida.write(translate.translate(line, 'en-pt')['text'][0])
os.system('clear')
print("Traduzindo...")
print(progresso, 'de', str(tamanho))
saida.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment