I am building a screen clipping app.
So far:
- I can get the html mark up of the part of the web page the user has selected including images and videos.
- I then send them to a server to process the html with BeautifulSoup to sanitize the html and convert all relative paths if any to absolute paths
Now I need to render the part of the page. But I have no way to render the styling. Is there any library to help me in this matter or any other way in python ?
One way would be to fetch the whole webpage with urllib2 and remove the parts of the body I don’t need and then render it.
But there must be a more pythonic way 🙂
Note: I don’t want a screenshot. I am trying to render proper html with styling.
Thanks 🙂
Download the complete webpage, extract the
styleelements and the stylesheetlinkelements and download the files referenced the latter. That should give you the CSS used on the page.