Created
April 10, 2014 12:33
-
-
Save ihercowitz/10377097 to your computer and use it in GitHub Desktop.
A batch downloader for youtube-dl
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 requests | |
| from lxml.html import fromstring | |
| import os | |
| search='https://www.youtube.com/results' | |
| def make_my_day(query): | |
| page = requests.get(search, params=[{'search_query', str(query)}]) | |
| links = fromstring(page.text).cssselect('a') | |
| videos = set(filter(lambda x: x is not None and x.__contains__('/watch'), map(lambda x: x.get('href'), links))) | |
| map(lambda x: os.system('youtube-dl -f mp4 https://youtube.com%s' %x), videos) | |
| #usage: | |
| #uncomment the lines belows and execute the script | |
| #for s in ['dora aventureira', 'go diego go', 'turma da monica', 'super why!', 'backyardigans']: | |
| # make_my_day(s.replace(' ', '+')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment