<html>my news article</html>
<title>scraping</title>
<p>the world of so many articles</p>
<p>has been placed in this blocknotes</p>
<p>and i really wanna scraped that html structure just as it is</p>
<p>with all the tags in the scrapped data</p>
How to scrap with all tags in it?
I want the scraped data to be like...........
</div>
This Python script may help:
from lxml import html
HTML = """<html>
<title>scraping</title>
<p>the world of so many articles</p>
<p>has been placed in this blocknotes</p>
<p>and i really wanna scraped that html structure just as it is</p>
<p>with all the tags in the scrapped data</p>
</html>"""
tree = html.fromstring(HTML)
print ' '.join("<p>{}</p>".format(x) for x in tree.xpath('//p/text()'))
Output:
<p>the world of so many articles</p> <p>has been placed in this blocknotes</p> <p>and i really wanna scraped that html structure just as it is</p> <p>with all the tags in the scrapped data</p>