View Single Post
Old 09-08-2015, 07:53 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,455
Karma: 27757438
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There are many examples of recipes that deal with responsive images.

First you need to remove auto_cleanup and set
use_embedded_content = False

Then examine the downloaded html, find the responsive images, which typically have something like a data-src or srcset attribute with the real image url and dummy src attribute. Once you understand the structure, write preprocess_html to fix the images. See for example the preprocess_html function in the CNN or National Geographic recipes.
kovidgoyal is offline   Reply With Quote