Python 我应该按照相同的规则对聚合块和分页进行爬网吗

Python 我应该按照相同的规则对聚合块和分页进行爬网吗,python,scrapy,Python,Scrapy,我想使用爬网分页和聚合块“每个广告url块” 但只有前一条规则在运行,其他规则则不在运行。您想准确执行什么?嗨,nikhil,我想从第1页、第2页、第3页提取广告url………因此,如果我同时使用两种循环规则(爬网分页和从每个页面获取广告url),是否可能。事实上,我是python新手。你到底想执行什么?嗨,nikhil,我想从第1页、第2页、第3页提取广告url………所以,如果我同时使用循环规则(爬网分页和从每个页面获取广告url),这是可能的。实际上,我是python新手。 class Fir

我想使用爬网分页和聚合块“每个广告url块”


但只有前一条规则在运行,其他规则则不在运行。

您想准确执行什么?嗨,nikhil,我想从第1页、第2页、第3页提取广告url………因此,如果我同时使用两种循环规则(爬网分页和从每个页面获取广告url),是否可能。事实上,我是python新手。你到底想执行什么?嗨,nikhil,我想从第1页、第2页、第3页提取广告url………所以,如果我同时使用循环规则(爬网分页和从每个页面获取广告url),这是可能的。实际上,我是python新手。
class FiregunsSpider(CrawlSpider):
    name = 'centerfireguns'
    allowed_domains = ['centerfireguns.com']
    start_urls = ['http://www.centerfireguns.com/firearms.html']

    rules = (
        Rule(SgmlLinkExtractor(allow=(), restrict_xpaths=('//a[contains(@class, "i-next")][1]')), follow=True), #if you check start_urls this regex for pagination 
        rule(SgmlLinkExtractor(allow=(), restrict_xpaths=('//a[contains(@class,"product-image")]')), callback='parse_item', follow=True) #and this regex for aggregate block.
    )