@@ -0,0 +1,1552 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Aimport urllib2%0Afrom HTMLParser import HTMLParser%0A%0A# HTML Tag Stripper class%0Aclass HTMLTagStripper(HTMLParser):%0A%0A    def __init__(self):%0A        self.reset()%0A        self.data = %5B%5D%0A        self.isScriptTag = False%0A        self.isStyleTag = False%0A%0A    def handle_starttag(self, tag, attr):%0A        # %3Cscript%3E tag flag%0A        if tag == 'script':%0A            self.isScriptTag = True%0A        elif tag == 'style':%0A            self.isStyleTag = True%0A%0A    def handle_endtag(self, tag):%0A        # %3C/script%3E (end) tag flag%0A        if tag == 'script':%0A            self.isScriptTag = False%0A        elif tag == 'style':%0A            self.isStyleTag = False%0A%0A    def handle_data(self, data):%0A        # as long as it's not a %3Cscript%3E and %3Cstyle%3E tag, store the data value%0A        if not self.isScriptTag and not self.isStyleTag:%0A            # but wait there's more! ...as long as it's not a line feed or tab%0A            if data and data != %22%5Cn%22 and data != %22%5Ct%22:%0A                # store/append the data and while we're at it, strip whitespaces, tags, line feed, and carriage return%0A                self.data.append(data.strip(' %5Ct%5Cn%5Cr'))%0A%0A    def get_data(self):%0A        # filter out null/None nodes%0A        resp = filter(None, self.data)%0A        return ' '.join(resp)%0A%0A# open the url/page%0Aresponse = urllib2.urlopen(%22https://www.python.org/%22)%0Ahtml = response.read()%0A%0A# remove HTML tags%0Ahts = HTMLTagStripper()%0Ahts.feed(html)%0A%0A# get the data and cast it as string%0Adata = str(hts.get_data())%0A%0A# print it out!%0Aprint(data)%0A

Add HTML tag stripper/remover (also remove <script> and <style> contents)