import requests
from readability import Document
import webbrowser,os

""" So we need a url that contains a lot of boilerplate. I found one. 
    You could insert any other url of your choice
"""
url = 'https://timesofindia.indiatimes.com/city/delhi/delhi-records-all-time-high-of-48-degrees-celsius-heat-wave-to-continue/articleshow/69727572.cms'

""" Fetch the webpage using requests library """
response = requests.get(url)

""" Run the Document function from reability package. This is what does the magic."""
document = Document(response.text)

""" We get the content using  the document.summary() function. 
    Let's write it down into a file a invoke a web browser to 
    see if we really did get what we wanted 
""" 
f = open('tempwebpage.html','w')
f.write(document.summary())
f.close()

webbrowser.open('file://' + os.path.realpath('tempwebpage.html'))