在从Google place details API获取许多商店的场所ID后,我正在尝试获取opening_hours。我在回复中没有得到任何开放时间,而当我直接在谷歌上搜索时,所有这些地方都显示了开放时间。例如,这是西夫韦,1071 El Camino Real,Redwood City,CA 94063,美国。
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJcY3Ya62jj4ARtl86jFsjUYE&fields=opening_hours&key=*******************
{
"html_attributions" : [],
"result" : {},
"status" : "OK"
}
看起来位置idChIJcY3Ya62jj4ARtl86jFsjUYE
的类型是subpremise
,而不是establishment
,所以这就是为什么您没有得到它的opening_hours
(因为没有(。该机构的场所id似乎是ChIJpwPigbKjj4ARC4XRyMdMzJ8
。
试试这个:https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJpwPigbKjj4ARC4XRyMdMzJ8&fields=opening_hours&密钥=YOUR_API_key
输出:
{
"html_attributions" : [],
"result" : {
"opening_hours" : {
"open_now" : false,
"periods" : [
{
"close" : {
"day" : 0,
"time" : "2200"
},
"open" : {
"day" : 0,
"time" : "0600"
}
},
{
"close" : {
"day" : 1,
"time" : "2200"
},
"open" : {
"day" : 1,
"time" : "0600"
}
},
{
"close" : {
"day" : 2,
"time" : "2200"
},
"open" : {
"day" : 2,
"time" : "0600"
}
},
{
"close" : {
"day" : 3,
"time" : "2200"
},
"open" : {
"day" : 3,
"time" : "0600"
}
},
{
"close" : {
"day" : 4,
"time" : "2200"
},
"open" : {
"day" : 4,
"time" : "0600"
}
},
{
"close" : {
"day" : 5,
"time" : "2200"
},
"open" : {
"day" : 5,
"time" : "0600"
}
},
{
"close" : {
"day" : 6,
"time" : "2200"
},
"open" : {
"day" : 6,
"time" : "0600"
}
}
],
"weekday_text" : [
"Monday: 6:00 AM – 10:00 PM",
"Tuesday: 6:00 AM – 10:00 PM",
"Wednesday: 6:00 AM – 10:00 PM",
"Thursday: 6:00 AM – 10:00 PM",
"Friday: 6:00 AM – 10:00 PM",
"Saturday: 6:00 AM – 10:00 PM",
"Sunday: 6:00 AM – 10:00 PM"
]
}
},
"status" : "OK"
}
希望这能有所帮助!