You are not logged in.

#1 2022-11-06 11:01:36

Registered: 2022-08-09
Posts: 23

Download playlist with youtube-dl

Download playlist with youtube-dl. Saving all data including the archive file into the uploader's folder for each video

This can't be done just with arguments as it says here: Set download-archive path with args

I want to make two similar scripts. One that downloads the videos and archive file in the uploader's folder for each video. And another script that also downloads the metadata.

The only way I can think of getting the uploader is to download the metadata with the output %(uploader)s.

Then create a folder with the uploader name, remove the file, and download again the files with the correct name from the created folder.

I have a few functions defined already that may help with this.

This is what I've tried. Are there any obvious mistakes?

# Video Playlist saving archive file to uploader's folder
ytp() {
  # Download metadata
  local opts=(
  # Get ten random characters
  local rand=$( cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1 )
  LOG_NAME=$( get_log_name "$(${paste[@]})" )

  $yt_dl ${opts[@]} --output "%(uploader|Anon-%(id)s)s.%(ext)s" "$(${paste[@]})" >> "/tmp/$LOG_NAME" 2>&1

  for f in *.info.json; do
    local name="${f%.*}"
    if [[ $name == Anon* ]]; then
    mkdir -p "$name"
    rm "$f"
    cd "$name" || exit

    # Download media

    cd .. || exit

Last edited by linuxscoop (2022-11-06 11:07:11)


Board footer

Powered by FluxBB