Пример #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
 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
 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