The more research I do, the more gloomy the worldview becomes.
I am trying to execute Flat Save or Static Save a web page with Python. This means merging all styles with built-in properties and changing all links to absolute URLs.
I have tried almost every free conversion website, api and even github libraries. No one is impressive. The best python implementation I could find for style alignment is https://github.com/davecranwell/inline-styler . I adapted it a bit for Flask, but the generated file is not so good. Here's what it looks like:

Obviously, he should look better. Here's what it should look like: http://cl.ly/image/1H3J1O1u3v3d
This seems like an endless struggle with malformed html, unrecognized CSS properties, Unicode errors, etc. And does anyone have a suggestion on a better way to do this? I understand that I can go to file -> save in my local browser, but when I try to do this en mass and extract a specific xpath that is not really viable.
It seems like the Evernote web clipper uses iFrames, but it seems more complicated than I think. But at least the clippings look decent on Evernote.
I am interested to know if anyone has any suggestions.
python html css html-parsing
Nick woodhams
source share