【scrapy 爬虫问题】 爬虫文件的parse函数没有执行,求解答
scrapy 中的爬虫部分的代码如下:
为什么连print(2)都不打印,实锤没有执行parse;setting文件中的代理也改为谷歌浏览器的了,其他都是默认的
import scrapy
from pachong2.items import MovieItem
from scrapy import Selector
class DoubanSpider(scrapy.Spider):
name = 'douban'
allowed_domains = ['movie.douban.com']
start_urls = ['http://movie.douban.com/top250']
def parse(self, response):
print(2)
sel = Selector(response)
list_items = sel.css('#content > div > div.article > ol> li')
print(list_items)
for list_item in list_items:
movie_item = MovieItem()
movie_item['title'] = list_item.css('span.title::text').extract_first()
movie_item['score'] = list_item.css('class.rating_num::text').extract_first()
yield movie_item