【发布时间】:2017-08-02 11:54:33
【问题描述】:
我在抓取 aliexpress 网站时遇到问题。
这是一个网址。
我想得到什么。
r = requests.get('https://www.aliexpress.com/item/Free-gift-100-Factory-Original-Unlocked-Apple-iphone-4G-8GB-16GB-32GB-Cell-phone-3-5/32691056589.html')
美丽的汤
content = soup.find('div', {'id':'j-product-tabbed-pane'})
lxml 解析。
root = html.fromstring(r.content)
results = root.xpath('//img[@alt="aeProduct.getSubject()"]')
f = open('result.html', 'w')
f.write(lxml.html.tostring(results[0]))
f.close()
这是我的代码,但给了我错误的结果。 在浏览器上检查具有该元素 但是上面的代码没有给我任何东西。
我认为 requests.get 没有给我正确的内容。但是为什么以及如何解决这个问题。他们检测为机器人?怎么能帮到我。 谢谢大家。
【问题讨论】:
-
你只想要这个漂亮的汤吗?