mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update new_yorker.recipe
This commit is contained in:
parent
aae88fa07e
commit
951ac22012
@ -92,17 +92,17 @@ class NewYorker(BasicNewsRecipe):
|
|||||||
noscript.name = 'div'
|
noscript.name = 'div'
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def preprocess_image(self, img_data, image_url):
|
# def preprocess_image(self, img_data, image_url):
|
||||||
from PIL import Image
|
# from PIL import Image
|
||||||
from calibre import fit_image
|
# from calibre import fit_image
|
||||||
from io import BytesIO
|
# from io import BytesIO
|
||||||
img = Image.open(BytesIO(img_data)).convert('RGB')
|
# img = Image.open(BytesIO(img_data)).convert('RGB')
|
||||||
scaled, nwidth, nheight = fit_image(img.width, img.height, 1024, 1024)
|
# scaled, nwidth, nheight = fit_image(img.width, img.height, 1024, 1024)
|
||||||
if scaled:
|
# if scaled:
|
||||||
img = img.resize((nwidth, nheight))
|
# img = img.resize((nwidth, nheight))
|
||||||
buf = BytesIO()
|
# buf = BytesIO()
|
||||||
img.save(buf, format='JPEG')
|
# img.save(buf, format='JPEG')
|
||||||
return buf.getvalue()
|
# return buf.getvalue()
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
# Get cover
|
# Get cover
|
||||||
|
Loading…
x
Reference in New Issue
Block a user