
split ( '.' ) m, s = divmod ( int ( sec ), 60 ) h, m = divmod ( m, 60 ) return ")'. group ( 3 )) else : return None def formatSrtTime ( secTime ): """Convert a time in seconds (google's transcript) to srt time format.""" sec, micro = str ( secTime ). compile ( r'(.*)?' ) def parseLine ( text ): """Parse a subtitle.""" m = re. NB: to get google's transcript, use tihs URL: """ # srt example """1 00:00:20,672 -> 00:00:24,972 Entre l’Australia et la South America, dans l’Océan South Pacific…""" # Google's transcript example (first tags) """ This is a matter of National Security.""" import re, sys # Pattern to identify a subtitle and grab start, duration and text. Takes google's transcript filename as argument (xml extension required). or 17.0 but 17) and it will be missing from output.

For example try YouTube video with ID v2jpnyKPH64, the second subtitle has timestamp 17 (not 17.00 or 17. #!/usr/bin/python # -*- encoding:utf-8 -*- """Translate Google's Transcript into srt file. A quick and dirty script to convert youtubes transcripts (xml format) to.
