如何使用 Scrapy 抓取返回 JSON 的 Web 请求?例如,JSON 看起来像这样:
{
"firstName": "John",
"lastName": "Smith",
"age": 25,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021"
},
"phoneNumber": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "fax",
"number": "646 555-4567"
}
]
}
我希望抓取特定项目(例如name
和fax
上面的项目)并保存到 csv。