Created
February 26, 2012 18:00
-
-
Save pankaj28843/1918004 to your computer and use it in GitHub Desktop.
Download multiple youtube videos at once
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
# -*- coding: utf-8 -*- | |
from BeautifulSoup import BeautifulSoup | |
input_file = file('input.txt') | |
soup = BeautifulSoup(input_file.read()) | |
for a in soup.findAll('a'): | |
if 'watch?v=' in a['href']: | |
print 'http://www.youtube.com'+a['href'] |
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
#!/bin/bash | |
cwd="$(pwd)" | |
#Uncomment following two lines if behind proxy | |
#http_proxy="http://10.3.100.212:8080" | |
#https_proxy="http://10.3.100.212:8080" | |
gedit input.txt | |
links="/tmp/$(date).txt" | |
python /home/psjinx/parse_youtube_urls.py > "$links" | |
rm input.txt | |
while read line | |
do | |
name=$(echo $(youtube-dl -e "$line").mp4); | |
dummy_url=$(youtube-dl -g "$line"); | |
path="$cwd/$name" | |
if [ ! -f "$path" ]; | |
then | |
echo $path | |
wget -c --no-verbose $dummy_url -O "$path"& | |
#aria2c -c -m0 -s10 -o "$path" $dummy_url & | |
fi | |
done < "$links" | |
rm "$links" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment