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?
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.
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.
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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With