question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[For Youtube] Bring back .JPG thumbnails for --write-thumbnail, add option for user to select which format of thumbnail to download

See original GitHub issue

Checklist

  • I’m reporting a feature request
  • I’ve verified that I’m running youtube-dl version 2021.04.07
  • I’ve searched the bugtracker for similar feature requests including closed ones

Description

Some months back, Youtube switched to webp format thumbnails. Youtube-DL followed suit and started downloading ONLY webp formats. This never sat well with me. I am so used to .JPG. It’s compatible with so many image-viewer programs which I’m more comfortable using. Even modern digital cameras still write to JPG. I therefore wrote my own script to download the JPG format thumbnails for all videos which Youtube-DL had downloaded. I have been using it all these months, whilst hoping that Youtube-DL would someday switch back to JPG. But it looks like webp is here to stay.

I am therefore putting in a request that you guys provide users the option to:

  1. pick which thumbnail format to download, for example --write-thumbnail [format code] eg --write-thumbnail 4
  2. Add the .JPG format thumbnail to the list of options, and the HIGHEST RESOLUTION JPG at that, though the lower-resolution JPG can be added too if the code change can accommodate it.

Right now, one can use --list-thumbnails to list all the thumbnail formats which are available, but no option to pick any one single format to download. This being the case, I’m not even sure what the point is of --list-thumbnails. You can see what options are available, but you can’t select any one of them. And I doubt that many people would have any use for --write-all-thumbnails. Moreover, with --list-thumbnails, only the webp formats are listed, even though a JPG thumbnails IS available for download.

Example usage of --list-thumbnails, showing that JPG formats which are available for download are omitted from the results:

$ youtube-dl --list-thumbnails "HOYDj769s6k"
[youtube] HOYDj769s6k: Downloading webpage
[info] Thumbnails for HOYDj769s6k:
ID  width  height URL
0   168    94     https://i.ytimg.com/vi/HOYDj769s6k/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLAlo8pT1iYu8kDBBWBEiItdBBjowQ
1   196    110    https://i.ytimg.com/vi/HOYDj769s6k/hqdefault.jpg?sqp=-oaymwEbCMQBEG5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLACFB4J9WHELxbdPNIrpP_ff5roZw
2   246    138    https://i.ytimg.com/vi/HOYDj769s6k/hqdefault.jpg?sqp=-oaymwEcCPYBEIoBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAVLxhs7hjapkWdvJNq-CoglmL0xg
3   336    188    https://i.ytimg.com/vi/HOYDj769s6k/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCD_AJAhppPPqHUT3nTrANr9NtGNQ
4   1920   1080   https://i.ytimg.com/vi_webp/HOYDj769s6k/maxresdefault.webp

The .JPG format URL is ALWAYS in one of two formats (sometimes both) in the HTML source code of every Youtube video webpage:

https://i.ytimg.com/vi/HOYDj769s6k/maxresdefault.jpg
https://i.ytimg.com/vi/HOYDj769s6k/hqdefault.jpg

This URL is found in the the HTML source code in a meta tag:

<meta property="og:image" content="https://i.ytimg.com/vi/HOYDj769s6k/maxresdefault.jpg">

User @aviv926 asked a question a few months ago about how to download the .JPG format thumbnail. One reply was to use curl as the user agent to obtain the url for the JPG and then download the JPG thumbnail:

$ youtube-dl HOYDj769s6k --get-thumbnail --user-agent curl/7.54.0
https://i.ytimg.com/vi/HOYDj769s6k/maxresdefault.jpg

$ youtube-dl HOYDj769s6k --write-thumbnail --user-agent curl/7.54.0
[youtube] HOYDj769s6k: Downloading webpage
[youtube] HOYDj769s6k: Downloading thumbnail ...
[youtube] HOYDj769s6k: Writing thumbnail to: Titan Missile Explosion HD-HOYDj769s6k.jpg

But I don’t like this because it means generating an extra webpage request just to download the thumbnail. If you’re downloading an entire channel with say 3000 videos, and then you DOUBLE the number of requests generated by Youtube-DL, you’ll get a “429: Too Many Requests” error for sure, and a subsequent IP ban for a few days. I would rather have Youtube-DL generate one webpage request, then extract all info, including the thumbnail URL, from that.

So to reiterate, I request that a feature be added which gives the user options on which thumbnail to download, and adds the .JPG thumbnail (at least the highest resolution version) as an option.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:7
  • Comments:5

github_iconTop GitHub Comments

10reactions
shoxie007commented, Apr 10, 2021

@aviv926

Thanks for you input. If other folks feel the same way, please add a comment to show your support.

0reactions
aviv926commented, Sep 28, 2021

I saw that you added the option to the--list-thumbnails I really appreciate it!

I wanted to ask is it possible to create a command that downloads all the images as a jpg from a YouTube channel? I tried running the following command but without success: youtube-dl.exe --write-thumbnail '[ext = jpg]' [URL HERE] or this youtube-dl.exe --write-thumbnail -4 --skip-download --output "%(title)s.%(ext)s" [URL HERE]

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Add Custom Thumbnails to Your YouTube Videos
After your video is finished uploading, you can choose a thumbnail from the three options YouTube automatically generates, or upload your ...
Read more >
How to Add or Change Thumbnails on YouTube Videos - 2022
In this tutorial, I show you how to upload custom thumbnails to your ... Find the video you want to add a thumbnail...
Read more >
Add video thumbnails on YouTube - Android - Google Help
Open the YouTube app . · Tap Library and then · Next to the video you'd like to edit, tap More and then...
Read more >
How can I download just thumbnails using youtube-dl?
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: ......
Read more >
[yt-dlp] How to choose a format for thumbnail download?
I see many formats with the --list-thumbnails command. But --write-thumbnail downloads only one *.webp 720р I want a different format (jpg) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found