It was recommended to me by a user on here that I make a post asking how I can combine several youtube-dl downloads into on single script to be run. I'm downloading lots of youtube channels and currently have every channel in a different .sh
file that I can run, but was told I can just combine them all into one file. An example of my scripts is:
./youtube-dl ytuser:user -ciw -o "/path/to/directory/%(upload_date)s-% \
(title)s.%(ext)s" --download-archive "/path/to/directory/downloaded.txt" \
--add-metadata --write-info-json --write-description --write-thumbnail \
--write-annotations --embed-subs -f \
"bestvideo[height<=720]+bestaudio/best[height<=720]" --merge-output-format \
"mkv"
So I have that exact script for every different channel, except of course modified so that each channel has it's own directory. Since I have so many I wanted to put them all in .sh
files and then have a script to run all the .sh
files, but again was told that this method was way over complicated and that there was a way to put all of the different command lines into a single script to be run.
Clarification:
So the /path/to/directory/
is going to be different for every channel, usually I don't need a URL since that is taken care of by the ytuser:*user*
section of the code. If there is a URL it will just be added at the very end of the code and the ytuser:*user*
will be deleted.
Currently I have lots of different .sh
files that all have code specific for one channel, so for example running h3h3Productions.sh
will open a terminal that downloads the channel "h3h3Productions" from YouTube into a directory like /youtube-dl/videos/vlogs/h3h3Productions/
and running WarLeaks.sh
will download the YouTube channel "WarLeaks" into the directory youtube-dl/videos/footage/WarLeaks/
.
So the code in each .sh
file is relatively the same, but the /path/to/directory/
and /path/to/directory/.downloaded.txt
, for the --archive-download
code, is different for all of them and the ytuser:*user*
is also different for every channel.
What I want to be able to do is just have one .sh
file that has the code for several different channels in it. That way, instead of running every .sh
file individually I can just have one .sh
file that when run will activate all of the downloads contained inside, since it will have the code for eight or ten different channels inside of it.
I hope that helps clarify if not please let me know.
/path/to/directory
different for every URL? Where is the URL, anyway? Shouldn't you be downloading something?ytuser:*user*
and target names and using a while loop to read them in and use them as needed to build the command line with the target being a suffix to the path? I don't know how critical the differences are between vlog and footage as mentioned in the question, but the same approach could be taken for both by perhaps having separate lists for each type. Perhaps @Bencc can clarify whether the aforementioned seperation is needed or if /blah/blah/videos/target would suffice