Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
shoxie007 opened this issue Apr 10, 2021 · 5 comments
Labels

Comments

@shoxie007
Copy link

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.

@aviv926
Copy link

aviv926 commented Apr 10, 2021

@shoxie007

Totally agree with you. It would be an amazing option if it came to fruition.
I myself did not even understand the idea of the command --list-thumbnails. is supposed to "excite"? LOL

Anyway I follow the updates from the developer on your post :)

@shoxie007
Copy link
Author

@aviv926

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

@pscj
Copy link

pscj commented Aug 10, 2021

want to select the thumbnails from list also. Sometimes I dont' want to get the best image quality.

@jackforlit
Copy link

Yes, it's better to add option for us to select thumbnail format.

@aviv926
Copy link

aviv926 commented 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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants