5

I have an issue with youtube-dl in Linux, so I want to create a bash script letting me download a playlist and put all the videos in a separate folder having the name of that playlist here is my attempt :

#!/bin/bash

echo 'Enter the URL of the playlist : '
read url
title = youtube-dl -o "%(title)s \"$url\""
mkdir "$title"
cd $title
youtube-dl --download-archive archive.txt $url

but it always gives this error :

[gerzal@dhcppc1 Videos]$ ./try.bash
Enter the URL of the playlist :
ff
youtube-dl -o %(title)s "ff"
./try.bash: line 6: title: command not found
mkdir: cannot create directory ‘’: No such file or directory

thanks in advance for help and it will be really appreciated.

update information:

I contacted one of the youtube-dl developers and he gave me the solution in one command line without adding mkdir command, here is the command line:

youtube-dl --download-archive archive.txt -o '%(playlist_title)s/%(title)s-%(id)s.%(ext)s' "$url"

1 Answer 1

0

Use the -o option with yt-dlp command to customize the output file name

  • For Index : %(playlist_index)s
  • For Title : %(title)s
  • For Youtuber name : %(uploader)s
  • For Video Id : %(id)s

yt-dlp -i -o "%(playlist_index)s-%(title)s-%(uploader)s-%(id)s" --get-filename --skip-download --no-warnings youtube_link

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .