youtube-dlyt-dlp

How to download the second (or third) video using ytsearch on yt-dlp / youtube-dl


If I do

$ yt-dlp ytsearch:"some query"

yt-dlp downloads the first result of "some query" and everything is fine. What if I want to download the second result, how can I achieve that?

If it is not possible just using shell, how can I do it with python.


Solution

  • The second result can be downloaded with ytsearch2. But the problem is that ytsearch2 downloads two videos. But conveniently, youtube-dl (yt-dlp) has an option to get the nth video with -I n. So the command becomes

    $ yt-dlp -I 2 ytsearch2:"some query"