[For Youtube] Bring back .JPG thumbnails for --write-thumbnail, add option for user to select which format of thumbnail to download
See original GitHub issueChecklist
- 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:
- pick which thumbnail format to download, for example --write-thumbnail [format code] eg --write-thumbnail 4
- 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:
- Created 2 years ago
- Reactions:7
- Comments:5
Top GitHub Comments
@aviv926
Thanks for you input. If other folks feel the same way, please add a comment to show your support.
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 thisyoutube-dl.exe --write-thumbnail -4 --skip-download --output "%(title)s.%(ext)s" [URL HERE]