赞
踩
from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from fbsPro.items import FbsproItem from scrapy_redis.spiders import RedisCrawlSpider class FbsSpider(RedisCrawlSpider): name = 'fbs' # allowed_domains = ['www.xxx.com'] # start_urls = ['http://www.xxx.com/'] # 创建一个redis列表对应的key redis_key = 'sun' # 链接提取器 link = LinkExtractor(allow=r'type=4&page=\d+') # 规则解析器 rules = ( Rule(link, callback='parse_item', follow=True), ) def parse_item(self, response): ... yield item
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。