Created
May 16, 2018 04:15
-
-
Save briantliao/1d8157b58b296983cf8e947910213ca2 to your computer and use it in GitHub Desktop.
Converts Berkeley Webcast HTML to youtube links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
args = sys.argv | |
assert(len(args) == 3) | |
_, input_file, ouput_file = tuple(args) | |
youtube_links = [] | |
with open(input_file) as f: | |
lines = f.readlines() | |
for line in lines: | |
if 'youtube' in line: | |
first_quote = line.find('\"') | |
second_quote = line.find('\"', first_quote + 1) | |
youtube_links.append(line[first_quote + 1:second_quote]) | |
with open(ouput_file, 'w') as g: | |
g.write(' '.join(youtube_links) + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment