Created
March 3, 2017 16:37
-
-
Save ColeMundus/83653a347aa4fe2690955568217cb165 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 == 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