gpt4 book ai didi

.net - Google Place API - 如何检索营业时间

转载 作者:行者123 更新时间:2023-12-04 21:59:42 27 4
gpt4 key购买 nike

有没有办法获得google place的营业时间?
我在几个论坛和文档中寻找,但我什么也没找到(也许只有 Foursquare API 公开了这些信息)

谷歌不公开这些信息?

有没有暴露这个的服务? ( Facebook 的地方,yelp,ecc..)

非常感谢大家的回复

阿尔贝托

最佳答案

我想这现在是可能的:

https://developers.google.com/places/documentation/details#PlaceDetailsResults

this gist如果您不想制作自己的 Places API key 或安装节点,请查看示例输出。

var request = require('request');
// $ npm install request
// Test code to demonstrate parsing operating hours from Google Places
// https://developers.google.com/places/documentation/details#PlaceDetailsResults

// most establishments specify one set of hours per day:
var testRef = 'CnRoAAAAhWUhxi1GkTSCMDMb2piX2JgQzcMv1v6Bv1rDWAINnWrI6T_Vkn3KRpnI5rTd2NI2f0zy4R8n6vRDoj-qTewKa3r70riORCUF-HNU1FLtI3MHNSw8z0_6fBni6hTuXCsGw1SD44I85ha9GVZOZlAS_hIQuNBJmgTHh9bCC4XvdLiDCBoUfmY1ozj0FW-TvurbmryBdwAvoPo';

// 24 hour restaurants only have one period with open:0000 and no close
var _24hrRef = 'CnRpAAAAcKNSNO0jxSONMAPx7EjG6BdgqhWbzDh1rOWM8I1HJZikRYPxW4L1A1ZwH4HEEBy5diKyXT1nRs2a7cxZK7S4oOr5HrTKewV_WGYdy-CuumuwLzSeckgXWvRdIRCW49JXUeJsqhkhtATHyyIDUYWW4RIQ38ZaUuG8A3WbRrsHLwmwDRoUfmtzSsfki7v8iBmUAZgrUIoVOt0'

// Restaurants that are closed on some days will have fewer than 7 open:close pairs

getPlaceDetails(_24hrRef, function(err, result){
if(err){
return console.log('Request error: '+err+result);
};
console.log('Request successful:')
console.log(JSON.stringify(result.opening_hours, null, 2));
});

function getPlaceDetails(ref,callback){
var config = {
uri:'https://maps.googleapis.com/maps/api/place/details/json',
qs: {
key: "SOME-VALID-GOOGLEPLACES-API-KEY",
// Generate a new Simple API key and plug it in
// https://code.google.com/apis/console
reference:ref,
sensor:'false',
}
};
request(config, function(err, response, body){
if(err){ return callback(err) };
var res = JSON.parse(body);
switch(res.status){
case "OK": return callback(null, res.result);
case "ZERO_RESULTS": return callback(null, res.result);
default: return callback(res.status, body);
};
});
};

关于.net - Google Place API - 如何检索营业时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10463396/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com