12

Python爬虫编程思想(70): 项目实战--抓取京东商城手机销售排行榜

 3 years ago
source link: https://blog.csdn.net/nokiaguy/article/details/121220505
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Python爬虫编程思想(70): 项目实战--抓取京东商城手机销售排行榜

        本文的例子使用requests抓取京东商城手机销售排行榜,并使用pyquery和CSS选择器提取相关的信息,同时将这些信息保存到Excel文件中。本例抓取总排行榜,并单独提取Apple、华为和小米手机的销售排行榜,将这些信息都保存在同一个Excel文件中,将这个Excel文件分成4个Sheet,第1个Sheet存储总排行榜,第2个Sheet存储Apple手机排行榜,第3个Sheet存储华为手机排行榜,第4个Sheet存储小米手机排行榜。

        在京东商城首页(https://www.jd.com)用“手机”关键字进行搜索,会产生如下的URL。

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&psort=3&cid2=653&cid3=655&s=121&click=0

        搜索界面如图1所示。


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK