youtube-dl; How download ONLY the playlist, NOT the files therein

Trying to get only the playlist content (should be 600+ entries) from an url, thus:

youtube-dl -i -v --flat-playlist --skip-download https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr

which according to the man page should list playlist entries while preventing files download.

Instead it hangs, after producing this output:

~ $ youtube-dl -i -v --flat-playlist --skip-download https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr  
[1] 4531  
~ $ [debug] System config: []  
[debug] User config: []  
[debug] Custom config: []  
[debug] Command-line args: ['-i', '-v', '--flat-playlist', '--skip-download', 'https://www.youtube.com/watch?v=CNotezuR73g']  
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8  
[debug] youtube-dl version 2018.07.10  
[debug] Python version 3.6.6 (CPython) - Linux-4.17.6-1-ARCH-x86_64-with-arch  
[debug] exe versions: ffmpeg 4.0.1, ffprobe 4.0.1, rtmpdump 2.4  
[debug] Proxy map: {}  
[youtube] CNotezuR73g: Downloading webpage  
[youtube] CNotezuR73g: Downloading video info webpage  
[debug] Default format spec: bestvideo+bestaudio/best  

How should I do this?


Did u read the page wysiwig suggested in his comment? (thanks @wysiwig!)

List Youtube playlist with youtube-dl

Anyway, here I'll try to explain what you could do (extracted from the previous web site)

Try using this command:

youtube-dl -j --flat-playlist "https://<yourYoutubePlaylist>" | jq -r '.id' | sed 's_^_https://youtu.be/_' > result.log

This will produce an output similar to this in result.log:

https://youtu.be/0gvUCLL-UGE
https://youtu.be/CPV7zcUy4J0
https://youtu.be/4wyZNwIrH9I
...

which should be what you need (a list of discrete links to YT videos).

Command explanation With the -j option youtube-dl will produce a JSON output which contains all the information about the link you pass (a playlist in this case).

This JSON output is then passed to jq JSON processor (you have to install it before see JQ website) searching for all the "id" keys contained in the JSON output (0gvUCLL-UGE,CPV7zcUy4J0,4wyZNwIrH9I,...). We then pass those "id"s to sed which will prefix each of them with https://youtu.be/ giving the result I shown before.

Note 1:To install JQ you can simply use: sudo apt-get install jq

Note 2:This approach works for Youtube only.


@wysiwig's method does produce output on linux, but not what I sought, thus :

$ youtube-dl --flat-playlist --skip-download https://www.youtube.com/playlist?list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr  

Output :

[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading webpage
[download] Downloading playlist: Full Length Arthouse Movies
[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading page #1
[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading page #2
[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading page #3
[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading page #4
[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading page #5
[youtube:playlist] PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr: Downloading page #6
[youtube:playlist] playlist Full Length Arthouse Movies: Downloading 636 videos
[download] Downloading video 1 of 636
[download] Downloading video 2 of 636
[download] Downloading video 3 of 636
...

What I really wanted to get from the playlist are the the video-names, so that I could pick out only those I want to download, which I get with :

$ youtube-dl -i --get-filename --skip-download https://www.youtube.com/playlist?list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr  

Output :

The Waiters (full length MOVIE, entire feature film, full film) _watch full movies for free-CNotezuR73g.mp4
Malcolm X (MORGAN FREEMAN, Full Movie, Englisch, Film in Full Length) _watch full movies for free-3C8j1C7HMj8.mp4
The Arizona Kid - Western, Full Movie, Full Length Feature Film starring ROY ROGERS, Classic Movies-8McZ6G2Uud8.mp4
Desperado Man aka Sagebrush Trail (Western Movie, Full Length Movie, Feature Film, Classic Movie)-7udmB5M6IIE.mp4
...


It appears you're not quoting the URL. Always quote URLs. On any operating system.

In your example, the issue is clearly visible:

~ $ youtube-dl -i -v --flat-playlist --skip-download https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr
[1] 4531

[1] 4531 means a job (ID 1) has been started and is running with PID 4531.

This command line is more or less equivalent to:

youtube-dl -i -v --flat-playlist --skip-download https://www.youtube.com/watch?v=CNotezuR73g &
list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr

The ampersand at the end means line 1 will be executed in the background. It’ll still be connected to your shell, so you’ll see its output. It’s probably not hanging, just finished: It’s just a link to a video after all.

Line 2 is a variable assignment in Bash. It’ll define a variable called list if it doesn’t already exist. It’ll be usable like this:

~ $ echo $list
PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr

The correct command line you want to use is:

youtube-dl -i -v --flat-playlist --skip-download "https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr"

  1. Make sure you have updated to the latest youtube-dl as it's updated frequently and old versions can stop working properly

    pip install --upgrade youtube_dl
    
  2. Enter appropriate command for output you want (videos NOT downloaded)

    Video id's only:

    youtube-dl --get-id https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr
    

    Title only:

    youtube-dl --get-title https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr
    

Can use either url format:

https://www.youtube.com/watch?v=CNotezuR73g&list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr https://www.youtube.com/playlist?list=PLm9l7EEbJuhyDYNuItj3sG8h3xAZbjIxr

The above commands just print to the screen (standard out). If you want to redirect to a file:

youtube-dl --get-id https://www.youtube.com/playlist?list=<playlist id>  > file.txt

Or print to screen AND redirect to file:

youtube-dl --get-id https://www.youtube.com/playlist?list=<playlist id> | tee file.txt

Ctrl-C to cancel the process