ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.73k stars 10.07k forks source link

Unable to download thumbnail for YouTube video #25988

Open bersbersbers opened 4 years ago

bersbersbers commented 4 years ago

Checklist

Verbose log

C:\Temp>youtube-dl -v VXhmeGZHRp8 --write-thumbnail
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'VXhmeGZHRp8', '--write-thumbnail']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2020.06.16.1
[debug] Python version 3.8.3 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg 4.3, ffprobe 4.3, rtmpdump 2.2d
[debug] Proxy map: {}
[youtube] VXhmeGZHRp8: Downloading webpage
[youtube] {18} signature length 106, html5 player 3662280c
[youtube] {135} signature length 102, html5 player 3662280c
[youtube] {244} signature length 106, html5 player 3662280c
[youtube] {134} signature length 102, html5 player 3662280c
[youtube] {243} signature length 102, html5 player 3662280c
[youtube] {133} signature length 106, html5 player 3662280c
[youtube] {242} signature length 106, html5 player 3662280c
[youtube] {160} signature length 106, html5 player 3662280c
[youtube] {278} signature length 106, html5 player 3662280c
[youtube] {140} signature length 106, html5 player 3662280c
[youtube] {249} signature length 106, html5 player 3662280c
[youtube] {250} signature length 106, html5 player 3662280c
[youtube] {251} signature length 106, html5 player 3662280c
[debug] Default format spec: bestvideo+bestaudio/best
[youtube] VXhmeGZHRp8: Downloading thumbnail ...
WARNING: Unable to download thumbnail "https://i.ytimg.com/vi_webp/VXhmeGZHRp8/maxresdefault.webp": HTTP Error 404: Not Found
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
...

Description

From a list of videos, 1 video failed to download a thumbnail, although Youtube is showing one and I see one in the browser (namely, https://i.ytimg.com/vi/VXhmeGZHRp8/hqdefault.jpg, https://i.ytimg.com/vi/VXhmeGZHRp8/maxresdefault.jpg). See verbose output above.

michaelb commented 4 years ago

may be related to PR #25717

EDIT:as suggested, at second glance those are completely different issues

bersbersbers commented 4 years ago

may be related to PR #25717

Related, yes, but nothing more. That PR is not merged yet, and converts webp files after download to jpg files with --embed-thumbnail. This is not the case here, the thumbnail is not even downloaded correctly.

ghost commented 3 years ago

For this video, thumbnail https://i.ytimg.com/vi_webp/VXhmeGZHRp8/maxresdefault.webp returned from YouTube doesn't exist as shown in the log. And I don't see thumbnail in Firefox. This is YouTube's problem, I think.

YouTube seems to return maxresdefault.* according to the user-agent. (youtube-dl's default user-agent is of Chrome.) Since you see maxresdefault.jpg in your browser, if you specifiy that user-agent, you would get maxresdefault.jpg.

Demo:

$ youtube-dl VXhmeGZHRp8 --get-thumbnail --user-agent curl/7.54.0
https://i.ytimg.com/vi/VXhmeGZHRp8/maxresdefault.jpg
$ youtube-dl VXhmeGZHRp8 -o "%(id)s.%(ext)s" --write-thumbnail --user-agent curl/7.54.0
[youtube] VXhmeGZHRp8: Downloading webpage
[youtube] VXhmeGZHRp8: Downloading thumbnail ...
[youtube] VXhmeGZHRp8: Writing thumbnail to: VXhmeGZHRp8.jpg
[download] VXhmeGZHRp8.mp4 has already been downloaded and merged