openzim / youtube

Create a ZIM file from a Youtube channel/username/playlist
GNU General Public License v3.0
53 stars 29 forks source link

Add new scraperlib features #106

Closed satyamtg closed 4 years ago

satyamtg commented 4 years ago

Set this to true explicitly to avoid confusions in the future and removes convert_thumbnail in favour of convert_image() from zimscraperlib

rgaudin commented 4 years ago

Please explicitly require scrpaerlib over 1.1.1

rgaudin commented 4 years ago

Could you replace convert_thumbnail now that we have that ability in scraperlib?

satyamtg commented 4 years ago

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

rgaudin commented 4 years ago

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

satyamtg commented 4 years ago

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.

rgaudin commented 4 years ago

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.

satyamtg commented 4 years ago

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.

video.zip

rgaudin commented 4 years ago

Yes, upgraded youtube-dl and do receives WebP in a .jpeg.