Last active
August 29, 2015 14:25
-
-
Save ag7/bd84d16e8fe457d98132 to your computer and use it in GitHub Desktop.
Download youtube mp3 playlist into specific folder.
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
#!/usr/bin/env python | |
import sys, os, subprocess | |
# requirements: youtube-dl and ffmpeg | |
if __name__ == "__main__": | |
if len(sys.argv) != 4: | |
print "usage: youtube_playlist_downloader.py -o <dir> <playlist-link>" | |
sys.exit(1) | |
if not os.path.isdir(sys.argv[2]): | |
try: | |
os.makedirs(sys.argv[2]) | |
except: | |
print "cannot create dir " + sys.argv[2] | |
sys.exit(1) | |
os.chdir(sys.argv[2]) | |
sys.exit(subprocess.call([ | |
"youtube-dl", | |
"-citx", | |
"--auto-number", | |
"--autonumber-size", "2", | |
"--audio-format", "mp3", | |
"--audio-quality", "0", | |
sys.argv[3]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment