目标:使用Scrapy,爬取当当网2018年图书销售榜单前3页的数据(图书名、作者和书的价格)。
URL:http://bang.dangdang.com/books/bestsellers/01.00.00.00.00.00-year-2018-0-1-1 (最后一个数字1代表第1页,每页20种)
网页源码:
展开后源码:
代码示例:
items.py文件参考代码#
#-*- coding: utf-8 -*-
# Define here the models for your scraped items## See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.htmlimport scrapy
class