예제 #1
0
파일: pinterest.py 프로젝트: after12am/mayb
 def clean(self, doc):
     doc = to_unicode_if_htmlentity(doc)
     # remove comment
     doc = re.compile('<!--.*?-->', re.DOTALL).sub('', doc)
     # remove ignore tags
     for tag in self.ignore_tags:
         doc = re.compile('<%s.*?/%s>' % (tag, tag), re.DOTALL).sub('', doc)
     return doc
예제 #2
0
 def clean(self, doc):
     doc = to_unicode_if_htmlentity(doc)
     # remove comment
     doc = re.compile('<!--.*?-->', re.DOTALL).sub('', doc)
     # remove ignore tags
     for tag in self.ignore_tags:
         doc = re.compile('<%s.*?/%s>' % (tag, tag), re.DOTALL).sub('', doc)
     return doc
예제 #3
0
파일: crawler.py 프로젝트: after12am/__TIL
 def clean(self, doc):
     doc = to_unicode_if_htmlentity(doc)
     doc = script_regx.sub('', doc)
     doc = noscript_regx.sub('', doc)
     doc = style_regx.sub('', doc)
     doc = iframe_regx.sub('', doc)
     doc = select_regx.sub('', doc)
     doc = comment_regx.sub('', doc)
     return doc
예제 #4
0
파일: cleanser.py 프로젝트: after12am/__TIL
def sweep(ss):
    # html cleansing
    ss = to_unicode_if_htmlentity(ss)
    ss = re.compile('<script.*?/script>', re.DOTALL).sub('', ss)
    ss = re.compile('<noscript.*?/noscript>', re.DOTALL).sub('', ss)
    ss = re.compile('<style.*?/style>', re.DOTALL).sub('', ss)
    ss = re.compile('<iframe.*?/iframe>', re.DOTALL).sub('', ss)
    ss = re.compile('<select.*?/select>', re.DOTALL).sub('', ss)
    ss = re.compile('<!--.*?-->', re.DOTALL).sub('', ss)
    return ss