这与使用Scrapy的
HtmlXPathSelectorhtml响应相同。唯一的区别是您应该使用
json模块来解析响应:
class MySpider(baseSpider): ... def parse(self, response): jsonresponse = json.loads(response.text) item = MyItem() item["firstName"] = jsonresponse["firstName"] return item
希望有帮助。

这与使用Scrapy的
HtmlXPathSelectorhtml响应相同。唯一的区别是您应该使用
json模块来解析响应:
class MySpider(baseSpider): ... def parse(self, response): jsonresponse = json.loads(response.text) item = MyItem() item["firstName"] = jsonresponse["firstName"] return item
希望有帮助。