Skip to content

Instantly share code, notes, and snippets.

@ColeMundus
Created March 3, 2017 16:45
Show Gist options
  • Save ColeMundus/6899458842f1863023ff06324ae3d692 to your computer and use it in GitHub Desktop.
Save ColeMundus/6899458842f1863023ff06324ae3d692 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)
subprocess.run('youtube-dl --merge-output-format mkv --external-downloader=aria2c --external-downloader-args "--min-split-size=1M --split=16 --max-connection-per-server=16" -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