首页 > 其他 > 详细

Splash简单应用

时间:2019-11-18 13:45:15      阅读:69      评论:0      收藏:0      [点我收藏+]

jd->iphone

import requests
from lxml import etree
#
search_key = iphone
jd_url = "https://search.jd.com/Search?keyword={}&enc=utf-8&wq={}&pvid=1a54a615e86645f8aaf828df04a78b27".format(
    search_key, search_key)
url = http://10.63.32.49:8050/render.html?url={}.format(jd_url)
print(url)
# http://10.63.32.49:8050/render.html?url=https://search.jd.com/Search?keyword=iphone&enc=utf-8&wq=iphone&pvid=1a54a615e86645f8aaf828df04a78b27
r = requests.get(url)
selector = etree.HTML(r.text)
li_list = selector.xpath(//div[@id="J_goodsList"]/ul/li)
for li in li_list:
    price, = li.xpath(.//div[@class="p-price"]//i/text())
    print(price)

 

Splash简单应用

原文:https://www.cnblogs.com/wt7018/p/11881357.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!