色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

python 爬蟲爬取京東ps4售賣情況

瀏覽:8日期:2022-07-01 17:41:25
代碼

#!/usr/bin/env python# -*- coding: utf-8 -*-# @File : HtmlParser.py# @Author: 趙路倉# @Date : 2020/3/17# @Desc :# @Contact : 398333404@qq.comimport jsonfrom lxml import etreeimport requestsfrom bs4 import BeautifulSoupurl='https://search.jd.com/Search?keyword=ps4&enc=utf-8&wq=ps4&pvid=cf0158c8664442799c1146a461478c9c'head={ ’authority’: ’search.jd.com’, ’method’: ’GET’, ’path’: ’/s_new.php?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&wq=%E6%89%8B%E6%9C%BA&cid2=653&cid3=655&page=4&s=84&scrolling=y&log_id=1529828108.22071&tpl=3_M&show_items=7651927,7367120,7056868,7419252,6001239,5934182,4554969,3893501,7421462,6577495,26480543553,7345757,4483120,6176077,6932795,7336429,5963066,5283387,25722468892,7425622,4768461’, ’scheme’: ’https’, ’referer’: ’https://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&wq=%E6%89%8B%E6%9C%BA&cid2=653&cid3=655&page=3&s=58&click=0’, ’user-agent’: ’Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36’, ’x-requested-with’: ’XMLHttpRequest’,}def page(page): print('開始') url = 'https://search.jd.com/Search?keyword=ps4&enc=utf-8&qrst=1&rt=1&stop=1&vt=1&wq=ps4&page='+page+'&s=181&click=0' r=requests.get(url,timeout=3,headers=head) r.encoding=r.apparent_encoding # print(r.text) b=BeautifulSoup(r.text,'html.parser') #print(b.prettify()) _element = etree.HTML(r.text) datas = _element.xpath(’//li[contains(@class,'gl-item')]’) print(datas) for data in datas: p_price = data.xpath(’div/div[@class='p-price']/strong/i/text()’) p_comment = data.xpath(’div/div[5]/strong/a/text()’) p_name = data.xpath(’div/div[@class='p-name p-name-type-2']/a/em/text()’) p_href = data.xpath(’div/div[@class='p-name p-name-type-2']/a/@href’) comment=’ ’.join(p_comment) name = ’ ’.join(p_name) price = ’ ’.join(p_price) href = ’ ’.join(p_href) print(name,price,p_comment,href)if __name__=='__main__': page('5')爬取結果

python 爬蟲爬取京東ps4售賣情況

以上就是python 爬蟲爬取某東ps4售賣情況的詳細內容,更多關于python 爬蟲的資料請關注好吧啦網其它相關文章!

標簽: 京東 Python
相關文章:
主站蜘蛛池模板: 国产精品一区二区国产 | 免费国产成人高清在线观看不卡 | 99视频免费在线观看 | 国产精品日韩专区 | 宅男毛片 | 亚洲 欧美 视频 | 99re最新这里只有精品 | 欧亚毛片| 免费男女乱淫真视频播放 | zztt40.su黑料不打烊官网 | 波多野结衣中文一区二区免费 | 亚洲国产精品网站久久 | 手机看片国产免费永久 | 三级黄色毛片视频 | 欧美成人中文字幕 | 高清三级毛片 | 国产精品视频第一区二区三区 | 久久亚洲精品中文字幕亚瑟 | 97久久精品午夜一区二区 | 91久久精一区二区三区大全 | 国产精品成aⅴ人片在线观看 | 性刺激久久久久久久久 | 成人免费一区二区三区在线观看 | 亚洲国产精品线观看不卡 | 久久久久在线视频 | 亚洲国内 | 黄色资源网址 | 香港一级特黄高清免费 | 国产一区二区三区高清 | 欧美韩国日本在线 | 成人在线免费看 | 亚洲小视频在线 | 久久一区二区精品综合 | 国产精品一 | 精品一区二区久久久久久久网站 | 亚洲国产欧美自拍 | 日韩三级黄色片 | 日本美女高清在线观看免费 | 六月丁香婷婷色狠狠久久 | 国产成人在线小视频 | 高清不卡日本v在线二区 |