Closed rgaudin closed 4 years ago
Video with low thumbnail: https://www.youtube.com/watch?v=5_G2L748abQ and the retrieved file hqdefault.jpg 336x188
What's funny is that youtube-dl reports this as biggest:
youtube-dl --list-thumbnails 5_G2L748abQ
[youtube] 5_G2L748abQ: Downloading webpage
[info] Thumbnails for 5_G2L748abQ:
ID width height URL
0 168 94 https://i.ytimg.com/vi/5_G2L748abQ/hqdefault.jpg?sqp=-oaymwEYCKgBEF5IVfKriqkDCwgBFQAAiEIYAXAB&rs=AOn4CLBMcSiRwgfK-PdG3weyQfwA4WjGQQ
1 196 110 https://i.ytimg.com/vi/5_G2L748abQ/hqdefault.jpg?sqp=-oaymwEYCMQBEG5IVfKriqkDCwgBFQAAiEIYAXAB&rs=AOn4CLB1r0huaij0n0xmZRKAt5bMNGNnXA
2 246 138 https://i.ytimg.com/vi/5_G2L748abQ/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLBoPogiCL9JvFu4LTtsyq67iOpvuA
3 336 188 https://i.ytimg.com/vi/5_G2L748abQ/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDv3cwuP5EupbNQGf4-tlsul9VB2Q
But if you fetch this same URL without the parameters, then it's 480x360…
Anyway we need to deal with what youtube-dl sends us (ie. what the uploader sent) and work from that ; so either upscale or insert centered in black frame.
https://github.com/openzim/python_scraperlib/pull/25 shall handle this.
Great. We shall still use allow_upscaling=True
.
Scrapers fails if thumbnail can't be resized-down. We should account for that and resize-up in this (rare) case. We'll fix it here and then backport to zimscraperlib.