Closed satyamtg closed 4 years ago
Please explicitly require scrpaerlib over 1.1.1
Could you replace convert_thumbnail
now that we have that ability in scraperlib?
I found out that sometimes youtube-dl returns a webp image with a jpg extension. This is strange. So I added code to convert to JPEG unconditionally
OK thanks for the head's up. Do you have an URL of such a case that we could add in the comment as this is clearly unexpected.
Also, rewrote variable names to make it clearer (it's a bit tricky!).
Actually, I think your code was wrong as thumb_src
would be the .webp (if it's a webp) and then you'd be resizing that instead of the .jpg one
OK thanks for the head's up. Do you have an URL of such a case that we could add in the comment as this is clearly unexpected.
Used this playlist
Actually, I think your code was wrong as
thumb_src
would be the .webp (if it's a webp) and then you'd be resizing that instead of the .jpg one
Oh. I really missed out on that. Thanks BTW.
Well there's a single video in that playlist and it's thumbnail as returned by youtube-dl is https://i.ytimg.com/vi/1ubWja9gP3A/hqdefault.jpg
here. And that's a JPEG.
Well, this is what actually gets downloaded for the aforementioned video in the scraper (zipped and attached). The output of libmagic on this file is -
'RIFF (little-endian) data, Web/P image, VP8 encoding, 336x188, Scaling: [none]x[none], YUV color, decoders should clamp'
Also, if we read it through PIL, the format is WEBP.
Yes, upgraded youtube-dl and do receives WebP in a .jpeg.
Set this to true explicitly to avoid confusions in the future and removes convert_thumbnail in favour of convert_image() from zimscraperlib