# -*- coding: utf-8 -*- import scrapy from scrapy.http import Request from scrapy.core.engine import ExecutionEngine class ChoutiSpider(scrapy.Spider): name = 'baidu' allowed_domains = ['baidu.com'] start_urls = ['http://baidu.com/'] def start_requests(self): for url in self.start_urls: yield Request(url,dont_filter=True,callback=self.parse1) #yield 返回一个生成器,生成器可以被循环 def parse(self, response): pass