Skip to content

Instantly share code, notes, and snippets.

@zeerorg
Last active August 1, 2016 06:24
Show Gist options
  • Save zeerorg/43d7e37ad5831fb06278a0a063764baf to your computer and use it in GitHub Desktop.
Save zeerorg/43d7e37ad5831fb06278a0a063764baf to your computer and use it in GitHub Desktop.
Uninterrupted youtube playlist download
import subprocess
import os
output_file = '%(playlist_index)s - %(title)s.%(ext)s' # do not change this
link = '' # replace with url of playlist
start_playlist = 1
number = 1
files = [ f for f in os.listdir(".") ]
for f in files:
f = f.split("-")[0]
try:
number = int(f)
except:
pass
if start_playlist < number:
start_playlist = number
while True:
try:
subprocess.check_call("youtube-dl -o '%s' --playlist-start %s '%s'" % (output_file, str(start_playlist), link), shell=True)
break
except KeyboardInterrupt:
break
except:
continue
#print ("youtube-dl -o '%s' '%s'" % (output_file, link))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment