Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I download just thumbnails using youtube-dl?

I've been trying to download the thumbnails of a list of URL's (youtube videos) I have.

I've been using youtube-dl and I've worked it out to this so far:

     import os

     with open('results.txt') as f:
          for line in f:
              os.system("youtube-dl " + "--write-thumbnail " + line)

Like this I'm able to download the thumbnails but I'm forced to downloading the youtube videos as well.

How can I just download the thumbnail?

like image 696
TheOlDirtyBastard Avatar asked Sep 21 '16 02:09

TheOlDirtyBastard


People also ask

Can you download YouTube thumbnails?

When the video is open just right-click anywhere in your browser and select save image as to download YouTube thumbnail on your computer. This URL is the one that will give you the best resolution of the video that you want.

Can YouTube-dl download anything?

youtube-dl is a command-line program that lets you easily download videos and audio from more than a thousand websites. See the list of supported sites.


2 Answers

You can simply add --skip-download to your code and it will work fine. Like so:

with open('urls.txt') as f:
for line in f:
    os.system("youtube-dl "+"--write-thumbnail "+"--skip-download "+line)
like image 115
Nicholas A. Randall Avatar answered Sep 22 '22 23:09

Nicholas A. Randall


Building on the other answers, you can also specify the -a or --batch-file flag to provide a list of files to import from, which simplifies the code a bit:

youtube-dl -a urls.txt --write-thumbnail --skip-download

like image 34
kdmurray Avatar answered Sep 22 '22 23:09

kdmurray