Created
March 26, 2015 19:21
-
-
Save nyctef/963e9c071d3516d18cef to your computer and use it in GitHub Desktop.
This file contains 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 bs4 import requests | |
import re | |
code = ''' | |
"kcaKrEV6f1Q", | |
"2yWwlill8dc", | |
"FQRIjzW-kg0", | |
"sGobBjJPJKk", | |
"qbgpn-twcSI", | |
"ynufwsOiZYg", | |
"Kt98_yJZVxU", | |
"4eEonyVTi7M", | |
"QaxmRAMWW6I", | |
"NtosJWq3COY", | |
"uws5WN9fWsk", | |
"dXWBKB46IF8", | |
"E50JDuVhx4Q", | |
"JUmqMwsDBQw", | |
"96b7Jk5xCTQ", | |
"hj9i6xg5kbo", | |
"VUbrHs35JYo", | |
"NkgAplqXxC4", | |
"CVr2tURDQLE", | |
"Ha0dHLQouEE", | |
"EbUVCUqDgnk", | |
"pVhwI8pAjFY", | |
"zh3_W9i5ALI", | |
"TFkDW3hSByw", | |
"xYuHY3ytUAw", | |
"tC8NzqACsKc", | |
"wdJFrywun9Y", | |
"S8ukXW06PmM", | |
"Hlpj9ikJ9YI", | |
"wOSUvK9ldsM", | |
"mfzZM6rexCI", | |
"1lGMZGpUDsY", | |
"rFNke6XnEz8", | |
"wd3QBJjs-Xg", | |
"MlMWt53ck-M", | |
"7b1NoJHwXTg", | |
"htcNuTovRIg" | |
'''.split('\n') | |
code = filter(None, code) | |
ids = map(lambda x: re.search('"([^"]+)"', x), code) | |
#ids = filter(lambda x: x is not None, ids) | |
ids = map(lambda x: x.group(1), ids) | |
print(list(ids)) | |
pages = map(lambda x: requests.get('http://youtube.com/watch?v='+x).text, ids) | |
titles = map(lambda x: bs4.BeautifulSoup(x).title.string, pages) | |
titles = map(lambda x: x[:-len(' - YouTube')], titles) | |
titles = map(lambda x: ' // ' + x, titles) | |
print('\n'.join(map(lambda x: ''.join(x), zip(code, titles)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment