创建一个crawl爬虫,爬取京东的商品信息,并且写入数据库中。
(1)创建scrapy项目 scrapy startproject jingdong
(2)常见自动爬取文件 scrapy genspider -t crawl jd jd.com
(3)items.py
![](https://upload-images.jianshu.io/upload_images/13406307-1a37350a8ab8b681.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
.
(4)jd.py
![](https://upload-images.jianshu.io/upload_images/13406307-9d34f9903f708b04.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(5)pipelines.py
![](https://upload-images.jianshu.io/upload_images/13406307-166b73bc311cafbc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(6)settings.py
![](https://upload-images.jianshu.io/upload_images/13406307-b8755c9876169238.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
标签:商品信息,python,py,爬取,scrapy,jd,crawl
来源: https://blog.csdn.net/fei347795790/article/details/90316898