2012-05-05 15 views
3

Googleの営業時間を取得する方法はありますか? 私はいくつかのフォーラムとドキュメントで探しましたが、何も見つかりませんでした(たぶん4スクエアのAPIだけでその情報が公開されています)。Google Place API - 営業時間を取得する方法

Googleはこの情報を公開していません。

これを公開するサービスはありますか? (Facebookの場所、Yelpの、ECC ...)すべてについて

ありがとうを

を返信アルベルト

+0

現在、GoogleプレイスAPIはこの機能をサポートしていません。 Places APIの問題追跡ツールには、次の機能リクエストがあります。http://code.google.com/p/gmaps-api-issues/issues/detail?id=2431 「スター」アイコンをクリックしてください将来の変更が通知され、解決を確認することに興味があることをお知らせします。 –

答えて

8

私はこれが可能になりました推測:

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

あなたがあなた自身のPlaces APIキーを作るか、またはノードをインストールしたくない場合は、サンプル出力用this gistを参照してください。

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); 
    }; 
    }); 
}; 
2

彼らは、FacebookのAPIを介して公開されています。例えば、ニューヨークのFAOシュワルツ氏は自分の時間を埋めています

はグラフAPIエクスプローラhttps://developers.facebook.com/tools/explorerを訪問し、ボックスに自分のIDを入力します。155199767827259

私はYelpのAPIはまた、この情報を公開してかなり確信しているが、あなたYelpの情報をきわめて明示的に属性付けする必要があります。

3

ファクトAPIは、何時間も操作を公開します。これは、米国の800kレストランで構成されるレストランAPIにあります。このフィールドは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/" 
関連する問題