def getFilteredPageContent(page, onlyText=True):
 retVal = page
 if isinstance(page, unicode):
  retVal = re.sub(('(?si)<script.+?</script>|<!--.+?-->|<style.+?</style>%s' % ('|<[^>]+>|\\t|\\n|\\r' if onlyText else '')), ' ', page)
  while (retVal.find('  ') != (-1)):
   retVal = retVal.replace('  ', ' ')
  retVal = htmlunescape(retVal.strip())
 return retVal

def getFilteredPageContent ( page , onlyText = True ) : retVal = page if isinstance ( page , unicode ) : retVal = re . sub ( ( '(?si)<script.+?</script>|<!--.+?-->|<style.+?</style>%s' % ( '|<[^>]+>|\\t|\\n|\\r' if onlyText else '' ) ) , ' ' , page ) while ( retVal . find ( '  ' ) != ( - 1 ) ) : retVal = retVal . replace ( '  ' , ' ' ) retVal = htmlunescape ( retVal . strip ( ) ) return retVal
returns filtered page content without script .