Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
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
Ejemplo n.º 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
Ejemplo n.º 5
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = lxml.html.fromstring(html)
     return self.doc
Ejemplo n.º 6
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc
Ejemplo n.º 7
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = lxml.html.fromstring(html)
     return self.doc
Ejemplo n.º 8
0
 def fromstring(self, html):
     from lxml.html import soupparser
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc
Ejemplo n.º 9
0
 def fromstring(self, html):
     from lxml.html import soupparser
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc
Ejemplo n.º 10
0
 def fromstring(self, html):
     html = encodeValue(html)
     self.doc = soupparser.fromstring(html)
     return self.doc