def parse(data, head_insert=None, urlrewriter=urlrewriter, parse_comments=False, js_proxy=False): if js_proxy: js_rewriter_class = JSWombatProxyRewriter else: js_rewriter_class = None parser = HTMLRewriter(urlrewriter, head_insert=head_insert, url=ORIGINAL_URL, js_rewriter_class=js_rewriter_class, parse_comments=parse_comments) if js_proxy: parser.js_rewriter.first_buff = '{ ' parser.js_rewriter.last_buff = ' }' if six.PY2 and isinstance(data, six.text_type): data = data.encode('utf-8') result = parser.rewrite(data) + parser.close() if six.PY2: # decode only for printing result = result.decode('utf-8') print(result)
def parse(data, head_insert=None, urlrewriter=urlrewriter): parser = HTMLRewriter(urlrewriter, head_insert = head_insert, url = ORIGINAL_URL) if isinstance(data, unicode): data = data.encode('utf-8') #data = urllib.quote(data, ':" =/-\\<>') result = parser.rewrite(data) + parser.close() # decode only for printing print result.decode('utf-8')
def parse(data, head_insert=None, urlrewriter=urlrewriter): parser = HTMLRewriter(urlrewriter, head_insert=head_insert) if isinstance(data, unicode): data = data.encode('utf-8') #data = urllib.quote(data, ':" =/-\\<>') result = parser.rewrite(data) + parser.close() # decode only for printing print result.decode('utf-8')
def parse(data, head_insert=None, urlrewriter=urlrewriter, parse_comments=False): parser = HTMLRewriter(urlrewriter, head_insert=head_insert, url=ORIGINAL_URL, parse_comments=parse_comments) if six.PY2 and isinstance(data, six.text_type): data = data.encode("utf-8") result = parser.rewrite(data) + parser.close() if six.PY2: # decode only for printing result = result.decode("utf-8") print(result)
def parse(data, head_insert=None, urlrewriter=urlrewriter, parse_comments=False): parser = HTMLRewriter(urlrewriter, head_insert=head_insert, url=ORIGINAL_URL, parse_comments=parse_comments) if six.PY2 and isinstance(data, six.text_type): data = data.encode('utf-8') result = parser.rewrite(data) + parser.close() if six.PY2: # decode only for printing result = result.decode('utf-8') print(result)
def parse(data, head_insert=None, urlrewriter=urlrewriter): parser = HTMLRewriter(urlrewriter, head_insert = head_insert) #data = data.decode('utf-8') result = parser.rewrite(data) + parser.close() # decode only for printing print result.decode('utf-8')