我正在努力从我曾经去过的个人项目的所有网站收集数据。我从 Yelp 导出数据,但评论列表只有公司名称,没有公司地址。我可以从签到处获取营业地点,但我并不总是签到我评论过的地方。我想知道是否有人使用 Yelp API 根据评论者(在本例中为我)获取具有地址(或至少是城市和州)的企业列表?
我浏览了 Yelp API 文档,但没有在审阅者上看到太多内容,除非您正在查看特定的业务。
是的,你是对的,你无法通过评论看到营业地点。 您可以对您查看的每个位置发出多个搜索请求,并循环结果以查找企业名称及其地址。
搜索端点文档在这里: https://docs.developer.yelp.com/reference/v3_business_search
curl --request GET \
--url 'https://api.yelp.com/v3/businesses/search?term=pizza&limit=20&location=Los+Angelis,CA' \
--header 'accept: application/json'
{
"businesses": [
{
"alias": "golden-boy-pizza-hamburg",
"categories": [
{
"alias": "pizza",
"title": "Pizza"
},
{
"alias": "food",
"title": "Food"
}
],
"coordinates": {
"latitude": 41.7873382568359,
"longitude": -123.051551818848
},
"display_phone": "(415) 982-9738",
"distance": 4992.437696561071,
"id": "QPOI0dYeAl3U8iPM_IYWnA",
"image_url": "https://yelp-photos.yelpcorp.com/bphoto/b0mx7p6x9Z1ivb8yzaU3dg/o.jpg",
"is_closed": true,
"location": {
"address1": "James",
"address2": "Street",
"address3": "68M",
"city": "Los Angeles",
"country": "US",
"display_address": [
"James",
"Street",
"68M",
"Los Angeles, CA 22399"
],
"state": "CA",
"zip_code": "22399"
},
"name": "Golden Boy Pizza",
"phone": "+14159829738",
"price": "$",
"rating": 4,
"review_count": 903,
"transactions": [
"restaurant_reservation"
],
"url": "https://www.yelp.com/biz/golden-boy-pizza-hamburg?adjust_creative=XsIsNkqpLmHqfJ51zfRn3A&utm_campaign=yelp_api_v3&utm_medium=api_v3_business_search&utm_source=XsIsNkqpLmHqfJ51zfRn3A"
}
],
"region": {
"center": {
"latitude": 37.76089938976322,
"longitude": -122.43644714355469
}
},
"total": 6800
}
但是,替换您过去的每条评论的术语和位置并不理想,您需要提出多个请求。