python - How can I pass parameters to --output in youtube-dl? -


have csv file bunch of youtube links. it's structured video-name \t part \t youtube-url

i want use youtube-dl python download each video , have saved video-name_part.extension - possible or can things %(name)s included in youtube-dl?

you can import youtube_dl module , pass parameters using parameter dictionary. need take @ the documentation finer control on can do, outtmpl allows control output format in way suggested.

the following script shows how go reading csv file:

import csv, youtube_dl  open("filelist.csv", "r") f_filelist:     csv_filelist = csv.reader(f_filelist, delimiter="\t")      cols in csv_filelist:         video_name = cols[0]         part = cols[1]         youtube_url = cols[2]          ydl_opts = {"outtmpl" : r"{}_{}.%(ext)s".format(video_name, part)}          youtube_dl.youtubedl(ydl_opts) ydl:             ydl.download([youtube_url]) 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -