Created
March 3, 2017 17:03
-
-
Save ColeMundus/567e41e24d84e56faea99020e24e06a5 to your computer and use it in GitHub Desktop.
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
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 == 50: | |
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