4

有没有办法获得谷歌地方的开放时间?我在几个论坛和文档中寻找,但我什么也没找到(也许只有foursquare API公开了这些信息)

谷歌不公开这些信息?

有没有暴露这个的服务?(脸书位置,yelp,ecc ..)

非常感谢大家的回复

阿尔贝托

4

3 回答 3

10

我想现在这是可能的:

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

如果您不想制作自己的 Places API 密钥或安装节点,请参阅此要点以获取示例输出。

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);
    };
  });
};
于 2013-07-09T02:05:04.277 回答
3

Factual API 也公开了操作时间。这是在餐厅 API 中,它由美国的 80 万家餐厅组成。该字段的结构为 JSON 哈希,其中一周中的每一天都由整数 cf 进行索引。ISO-8601:1 = 周一至 7 = 周日。

文档 - http://developer.factual.com/display/docs/Places+API+-+Restaurants

餐厅数据演示 - http://www.factual.com/data/t/restaurants-us

餐厅实体的示例。

24: 24,
open_24hrs: false,
accessible_wheelchair: true,
address: "3274 21st St",
alcohol: false,
alcohol_bar: false,
alcohol_beer_wine: false,
alcohol_byob: false,
attire: "casual",
category: "Food & Beverage > Restaurants > Pizza",
country: "US",
cuisine: "Pizza, Italian, American, Fast Food, Pasta",
factual_id: "5873129b-11e9-49db-a012-967b4046420d",
fax: "(415) 695-1687",
founded: "1999",
groups_goodfor: false,
hours: "{"1":[["11:00","24:00"]],"2":[["11:00","24:00"]],"3":[["11:00","24:00"]],"4":[["11:00","24:00"]],"5":[["11:00","1:00"]],"6":[["11:00","1:00"]],"7":[["11:00","24:00"]]}",
kids_goodfor: true,
latitude: 37.75694,
locality: "San Francisco",
longitude: -122.42052,
meal_cater: true,
meal_deliver: true,
meal_dinner: true,
meal_lunch: true,
meal_takeout: true,
name: "Serrano's Pizza and Pasta",
options_vegan: true,
options_vegetarian: true,
owner: "Serranos Pizza",
parking: true,
payment_cashonly: false,
postcode: "94110",
price: 2,
rating: 4.5,
region: "CA",
reservations: false,
seating_outdoor: true,
smoking: false,
status: "1",
tel: "(415) 695-1615",
website: "http://www.serranospizza.com/"
于 2012-05-07T20:19:37.407 回答
2

它们通过 Facebook API 公开。例如,纽约市的粮农组织 Schwartz 已经填写了他们的工作时间:

访问 Graph API Explorer https://developers.facebook.com/tools/explorer并在框中输入他们的 ID:155199767827259

我很确定 Yelp API 也公开了这些信息,但你必须非常明确地归类任何 Yelp 信息。

于 2012-05-05T17:03:32.647 回答