youtube-dl | Download playlist in respective directory

2

1

I am using Ubuntu 14.04 and youtube-dl to download videos. How can I download videos in respective directory?

e.g. Playlist name is: MyPlaylist, that contains several videos

how can I download videos in directory like: MyPlaylist/index_title.ext

Piyush Kumar Baliyan

Posted 2015-10-30T15:35:15.437

Reputation: 123

have you really not considered specifying an mv command after, to move the file where you want it to be – barlop – 2015-10-30T16:05:22.620

@barlop I wanted to do it on-the-go, with some inbuilt option in youtube-dl. Look at the accepted answer, that perfectly resolves my query. – Piyush Kumar Baliyan – 2015-10-31T04:26:11.030

Sure but you could have put in your question that you wanted to do it without mv, and using functionality of youtube-dl – barlop – 2015-10-31T11:58:07.413

Answers

3

Have you checked the documentation? Specifically the -o, --output option. Using that, you should be able to do:

youtube-dl -o '/home/me/%(playlist_title)s/%(playlist_index)s_%(title)s.%(ext)s

That said, please be sure to respect the owner's rights with any videos you use this program for.

nerdwaller

Posted 2015-10-30T15:35:15.437

Reputation: 13 366

Thanks, That saved me a lot of work. And I'll keep the disclaimer in mind. – Piyush Kumar Baliyan – 2015-10-31T04:20:46.650

0

See Output template examples. https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template-examples

# Download YouTube playlist videos in separate directory indexed by video order in a playlist
$ youtube-dl -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re

# Download all playlists of YouTube channel/user keeping each playlist in separate directory:
$ youtube-dl -o '%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/user/TheLinuxFoundation/playlists

My example.

youtube-dl -ci -o "~/dl.folder/%(playlist_title)s/%(title)s-%(id)s.%(ext)s" --write-sub --convert-subs srt -k --download-archive archive.txt --proxy socks5://127.0.0.1:1080/ https://www.youtube.com/channel/UCzBGtBze1AIcDmRwD2ZjiAA

-o, --output TEMPLATE Output filename template, see the "OUTPUT TEMPLATE" for all the info

~

-c, --continue Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.

~

-i, --ignore-errors Continue on download errors, for example to skip unavailable videos in a playlist

~

--download-archive FILE Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it.

~

--proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme. For example socks5://127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection

~

--write-sub Write subtitle file

~

-k, --keep-video Keep the video file on disk after the post-processing; the video is erased by default

~

--convert-subs FORMAT Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc)

ref:

https://ytdl-org.github.io/youtube-dl/index.html

https://github.com/ytdl-org/youtube-dl/blob/master/README.md

https://github.com/ytdl-org/youtube-dl/blob/master/README.md#output-template

youtube-dl --help (youtube-dl --version 2019.08.13)

Nick Dong

Posted 2015-10-30T15:35:15.437

Reputation: 208