Ubuntu – Can I download videos from a YouTube search query using youtube-dl

videoyoutubeyoutube-dl

I want to download videos from a YouTube search query using youtube-dl. Suppose I want videos from the search query https://www.youtube.com/results?q=how+to+create+android+app+in+android+studio.

How can I download query-based videos from YouTube as well as other video sites? This is what I've tried, and it leads to the following error:
error

Best Answer

  • There is a built-in search option for youtube-dl. Old way:

    youtube-dl "gvsearch1:how to create android app in app studio"
    

    The argument is: gvsearchX, where gvsearch means use google and X is the number of results you want to download. So the above will search for "how to create android app in app studio" and download the first result.

    (Update!) Seems like ytsearch (youtube search) is the better approach now:

    youtube-dl "ytsearch1:how to create android app in app studio"
    
  • Related Question