0
我是Scrapy的新手。我想从日本网站上获取一些数据,但是当我运行下面的蜘蛛时,它不会在导出的文件上显示任何数据。有人能帮助我吗。Scrapy使用Scrapy的日本网站,但没有输出文件中的数据
导出为csv格式并不会在shell中显示任何结果,只是[]
。
这是我的代码。
import scrapy
class suumotest(scrapy.Spider):
name = "testsecond"
start_urls = [
'https://suumo.jp/jj/chintai/ichiran/FR301FC005/?tc=0401303&tc=0401304&ar=010&bs=040'
]
def parse(self, response):
# for following property link
for href in response.css('.property_inner-title+a::attr(href)').extract():
yield scrapy.Request(response.urljoin(href), callback=self.parse_info)
# defining parser to extract data
def parse_info(self, response):
def extract_with_css(query):
return response.css(query).extract_first().strip()
yield {
'Title': extract_with_css('h1.section_title::text'),
'Fee': extract_with_css('td.detailinfo-col--01 span.detailvalue-item-accent::text'),
'Fee Descrition': extract_with_css('td.detailinfo-col--01 span.detailvalue-item-text::text'),
'Prop Description': extract_with_css('td.detailinfo-col--03::text'),
'Prop Address': extract_with_css('td.detailinfo-col--04::text'),
}
没有解决的问题。现在得到一个错误'spider_exception/AttributeError:30'@Granitosaurus –
@bassamfarooq你可以发布日志吗?好像现在你完全有一个不同的问题。你可以在linux上通过'scrapy crawl myspider&> output.log'命令产生一个日志。或者至少复制你得到的整个回溯错误信息。 – Granitosaurus
@bassamfarooq我试过运行你的蜘蛛,发现错误,请参阅我的编辑。 – Granitosaurus