예제 #1
0
 def fromstring(self, html):
     html = encodeValue(html)
     try:
         self.doc = lxml.html.fromstring(html)
     except:
         html = html.encode('utf-8','replace')
         self.doc = lxml.html.fromstring(html)
     return self.doc
예제 #2
0
 def fromstring(self, html):
     html = encodeValue(html)
     try:
         self.doc = lxml.html.fromstring(html)
     except:
         html = html.encode("ascii", "replace")
         self.doc = lxml.html.fromstring(html)
     return self.doc
예제 #3
0
파일: parsers.py 프로젝트: chyt/gisty-goose
 def fromstring(self, html):
     encoding = get_encodings_from_content(html)
     encoding = encoding and encoding[0] or None
     if not encoding:
         html = encodeValue(html)
         self.doc = lxml.html.fromstring(html)
     else:
         html = smart_str(html, encoding=encoding)
         parser = lxml.html.HTMLParser(encoding=encoding)
         self.doc = lxml.html.fromstring(html, parser=parser)
     return self.doc
예제 #4
0
 def fromstring(self, html):
     encoding = get_encodings_from_content(html)
     encoding = encoding and encoding[0] or None
     if not encoding:
         html = encodeValue(html)
         self.doc = lxml.html.fromstring(html)
     else:
         html = smart_str(html, encoding=encoding)
         parser = lxml.html.HTMLParser(encoding=encoding)
         self.doc = lxml.html.fromstring(html, parser=parser)
     return self.doc
예제 #5
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = lxml.html.fromstring(html)
     return self.doc
예제 #6
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc
예제 #7
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = lxml.html.fromstring(html)
     return self.doc
예제 #8
0
파일: parsers.py 프로젝트: chyt/gisty-goose
 def fromstring(self, html):
     from lxml.html import soupparser
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc
예제 #9
0
 def fromstring(self, html):
     from lxml.html import soupparser
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc
예제 #10
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc