pyquery icon indicating copy to clipboard operation
pyquery copied to clipboard

got the wrong html content which is not same as original content

Open a-whitej opened this issue 11 years ago • 1 comments

from pyquery import PyQuery as pq from lxml import etree import urllib2

url_location='http://v.163.com/special/opencourse/machinelearning.html'

d = pq(url=url_location)

response = urllib2.urlopen(url_location) html = response.read() d = pq(html) print d.html()

We got the wrong html content which is not same as original content('http://v.163.com/special/opencourse/machinelearning.html')

a-whitej avatar Jun 26 '14 03:06 a-whitej

I guess that's because it doesn't use the same parser See https://github.com/gawel/pyquery/blob/master/pyquery/pyquery.py#L195

pq(url=url, parser='xml') should do what you want

gawel avatar Jun 30 '14 11:06 gawel