您的代码存在问题,无法正常打印response。原因是在parse_item函数中,您没有返回任何内容。应该在函数中添加返回语句来返回response,如下所示:

def parse_item(self, response):
    print(response)
    return response

这样就可以正常打印response了。

import scrapyfrom scrapylinkextractors import LinkExtractorfrom scrapyspiders import CrawlSpider Ruleclass SunSpiderCrawlSpider name = sun #allowed_domains = wwwsuncom start_urls = httpswwwku

原文地址: http://www.cveoy.top/t/topic/hQXn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录