请问为什么这个爬虫没有爬出内容啊
item.py
python
-*- coding: utf-8 -* import scrapy class BokeItem(scrapy.Item): url=scrapy.Field() title=scrapy.Field() content=scrapy.Field()
boke_spider.py
python
-*- coding: utf-8 -*- from scrapy.contrib.spiders import CrawlSpider ,Rule from scrapy.contrib.linkextractors import LinkExtractor from boke.items import BokeItem class BokeItem(CrawlSpider): name = 'blog' start_urls =['http://blog.sina.com.cn/s/blog_4701280b0102eo83.html'] def parse_torrent(self,response): torrent=BokeItem() torrent['url']=response.url torrent['title']=response.xpath("//h2[@class='titName SG_txta']/text()").extract()[0] torrent['content']=response.xpath("//div[@style='min-height:22px']/text()").extract()[0] return torrent
膜拜桂雏菊
11 years, 8 months ago