Skip to content

Instantly share code, notes, and snippets.

@ColeMundus
Created March 3, 2017 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColeMundus/83653a347aa4fe2690955568217cb165 to your computer and use it in GitHub Desktop.
Save ColeMundus/83653a347aa4fe2690955568217cb165 to your computer and use it in GitHub Desktop.
import time
import subprocess
d = open('done.txt', 'r+')
done = d.readlines()
i = 0
n = 0
with open('ids.txt') as f:
for line in f:
n += 1
time.sleep(1)
try:
print ('Already downloaded video ' + done[n - 1])
except IndexError:
if i == 10:
print('Uploading Videos to Google Drive')
subprocess.run('rclone copy /root/videos ugd:/berkley', shell=True, stdout=subprocess.PIPE)
time.sleep(1)
print('Deleting already uploaded videos')
subprocess.run('rm -rf /root/videos/*', shell=True, stdout=subprocess.PIPE)
i = 0
print 'Downloading video ' + line
print 'youtube-dl --merge-output-format mkv --external-downloader=axel -o /root/videos/$fileNameFormat - \($video.id\) ' + 'www.youtube.com/watch?v=' + line
subprocess.run('youtube-dl --merge-output-format mkv --external-downloader=aria2c -o "/root/videos/%(title)s - [%(id)s].%(ext)s" ' + 'http://www.youtube.com/watch?v=' + line, shell=True, stdout=subprocess.PIPE)
d.writelines(line)
i += 1
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment