Last active
July 30, 2021 14:12
-
-
Save masala-man/8ef03413319c87b9ac3d6f7cc87a1ae2 to your computer and use it in GitHub Desktop.
Download youtube videos listed in a file to flac format and rename
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 os | |
import re | |
import string | |
fileName = '' | |
vidReg = re.compile(r'youtube\.com') | |
fileRead = open('./req.txt') | |
length = len(open('./req.txt').readlines( )) | |
video = fileRead.readlines() | |
for x in range(length): | |
cut = video[x] | |
cut = cut[:-1] | |
video[x] = cut | |
for x in range(length): | |
vidMatch = vidReg.search(video[x]) | |
if vidMatch != None: | |
if len(fileName) > 0: | |
os.system('youtube-dl -x --audio-format flac ' + ' -o \"' + fileName + '.%(ext)s\" ' + video[x] ) | |
else: | |
os.system('youtube-dl -x --audio-format flac ' + video[x]) | |
else: | |
fileName = video[x] | |
#--req.txt-- | |
#Namana Natavara | |
#https://www.youtube.com/watch?v=enC-zfmvbcs | |
#Lagi Kalejwa Katar | |
#https://www.youtube.com/watch?v=Ww6aQe7qqWQ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment