2014-04-22 39 views
0

使用fql我得到一些照片。 Photo桌子的字段爲place_id,其中大部分我的照片都是頁面上的page_id-沒有問題。但與Instagram拍攝的照片有一個place_id但不對應任何頁面,當我檢查與Facebook的照片:該地點鏈接到四方頁面。place_id鏈接到foursquare?

我的疑問是:我如何才能正確鏈接到foursquare與place_id?因爲我需要知道我的照片拍攝地點。

例子:

place_id爲 '10150673541763630'
照片place link在Facebook是 'https://pt.foursquare.com/v/pra%C3%A7a-da-alegria/4caf06ba39458cfa4fcbf69f'

謝謝。

回答

0

沒有真的確定要在這裏實現......如果使用圖形API查詢OBJECT_ID 10150673541763630,你會得到下面的查詢內容:

https://graph.facebook.com/10150673541763630?metadata=1 

我加入了metadata=1參數,這樣就可以了看,這是不是一個地方的對象,但opengraphobject:playfoursquare:venue類型,而不是一個Opengraph對象:

{ 
    "id": "10150673541763630", 
    "application": { 
    "id": "86734274142", 
    "name": "Foursquare", 
    "url": "https://www.facebook.com/apps/application.php?id=86734274142" 
    }, 
    "created_time": "2012-03-15T09:54:03+0000", 
    "data": { 
    "location": { 
     "latitude": 38.717880681017, 
     "longitude": -9.1449693651909 
    }, 
    "number_of_tips": 4, 
    "appears_on_lists": [ 
     { 
     "id": "140732802766102", 
     "title": "lisboa", 
     "type": "playfoursquare:list", 
     "url": "https://foursquare.com/user/13257476/list/50e1baefe4b08361cf80d168" 
     }, 
     { 
     "id": "1375724855996686", 
     "title": "lisbon", 
     "type": "playfoursquare:list", 
     "url": "https://foursquare.com/user/29376791/list/51bb16d5498e67eeccae7fe6" 
     }, 
     { 
     "id": "516155125119081", 
     "title": "Lisboa cidade mais linda do mundo", 
     "type": "playfoursquare:list", 
     "url": "https://foursquare.com/user/48582854/list/519e166a498eda6c7172e41f" 
     }, 
     { 
     "id": "513522255419487", 
     "title": "Viagens", 
     "type": "playfoursquare:list", 
     "url": "https://foursquare.com/user/15581998/list/51192e94e4b051a095440d50" 
     } 
    ] 
    }, 
    "image": [ 
    { 
     "height": 600, 
     "url": "https://irs0.4sqi.net/img/general/600x600/49647321_ncDPc4_3OJUkYvj6CbwNHSyFIEJ79gqUuod5tGlXuL0.jpg", 
     "width": 600 
    }, 
    { 
     "url": "https://irs0.4sqi.net/img/general/600x600/XYS8qBTzuJfSX0k-8cAqU7XXQMZ4eigkm3gG7izySHI.jpg" 
    }, 
    { 
     "url": "https://irs0.4sqi.net/img/general/600x600/rWkkCyKRDWMA7IiGjHmw07ESIOapLFUFJq5D60beSHw.jpg" 
    }, 
    { 
     "url": "https://irs1.4sqi.net/img/general/600x600/nT0Yk6Houl-9biiwOqzTeSK56v1sXHTlnnYMyK1Iin0.jpg" 
    } 
    ], 
    "is_scraped": true, 
    "site_name": "Foursquare", 
    "title": "Praça da Alegria", 
    "type": "playfoursquare:venue", 
    "updated_time": "2014-04-22T23:10:39+0000", 
    "url": "https://foursquare.com/v/pra%C3%A7a-da-alegria/4caf06ba39458cfa4fcbf69f", 
    "metadata": { 
    "fields": [ 
     { 
     "name": "id", 
     "description": "The Open Graph object ID", 
     "type": "numeric string" 
     }, 
     { 
     "name": "admins", 
     "description": "A list of admins", 
     "type": "list<opengraphobjectprofile>" 
     }, 
     { 
     "name": "application", 
     "description": "The application that created this object", 
     "type": "opengraphobjectprofile" 
     }, 
     { 
     "name": "audio", 
     "description": "A list of audio URLs", 
     "type": "list<opengraphobjectaudio>" 
     }, 
     { 
     "name": "created_time", 
     "description": "The time the object was created", 
     "type": "datetime" 
     }, 
     { 
     "name": "data", 
     "description": "Custom properties of the object", 
     "type": "opengraphstruct:playfoursquare:venue" 
     }, 
     { 
     "name": "description", 
     "description": "A short description of the object", 
     "type": "string" 
     }, 
     { 
     "name": "determiner", 
     "description": "The word that appears before the object's title", 
     "type": "string" 
     }, 
     { 
     "name": "image", 
     "description": "A list of image URLs", 
     "type": "list<opengraphobjectimagevideo>" 
     }, 
     { 
     "name": "is_scraped", 
     "description": "Whether the object has been scraped", 
     "type": "bool" 
     }, 
     { 
     "name": "locale", 
     "description": "The locale the object is in", 
     "type": "opengraphobjectlocale" 
     }, 
     { 
     "name": "post_action_id", 
     "description": "The action ID that created this object", 
     "type": "id" 
     }, 
     { 
     "name": "profile_id", 
     "description": "The Facebook ID of a user that can be followed", 
     "type": "opengraphobjectprofile" 
     }, 
     { 
     "name": "restrictions", 
     "description": "Any restrictions that are placed on this object", 
     "type": "opengraphobjectrestrictions" 
     }, 
     { 
     "name": "see_also", 
     "description": "An array of URLs of related resources", 
     "type": "list<string>" 
     }, 
     { 
     "name": "site_name", 
     "description": "The name of the web site upon which the object resides", 
     "type": "string" 
     }, 
     { 
     "name": "title", 
     "description": "The title of the object as it should appear in the graph", 
     "type": "string" 
     }, 
     { 
     "name": "type", 
     "description": "The type of the object", 
     "type": "string" 
     }, 
     { 
     "name": "updated_time", 
     "description": "The last time the object was updated", 
     "type": "datetime" 
     }, 
     { 
     "name": "url", 
     "description": "The canonical URL of the object, used as its ID in the graph", 
     "type": "string" 
     }, 
     { 
     "name": "video", 
     "description": "A list of video URLs", 
     "type": "list<opengraphobjectimagevideo>" 
     } 
    ], 
    "type": "opengraphobject:playfoursquare:venue", 
    "connections": { 
     "comments": "https://graph.facebook.com/10150673541763630/comments", 
     "likes": "https://graph.facebook.com/10150673541763630/likes", 
     "picture": "https://graph.facebook.com/10150673541763630/picture" 
    } 
    } 
} 

可以使用以下查詢找到所有的Instagram發佈的實際用戶的照片:

select object_id, place_id from photo where aid in (select aid from album where name="Instagram Photos" and owner=me()) 

然後,您可以遍歷列表並通過標準Graph API請求每張照片的詳細信息,如上所示。然後在結果對象中找到data.location以下的位置。

或者,您可以使用批處理API一次(https://developers.facebook.com/docs/graph-api/making-multiple-requests/),要求多個對象,或用逗號串接的place_ids併發出這樣的請求:

https://graph.facebook.com/?ids={og_place1_id},{og_place2_id}&fields=id,data.location 
+0

託比這是我想要的信息,你知道它存儲在哪個fql表中嗎?謝謝 –

+0

正如我寫的,你必須通過標準的圖形API請求,而不是FQL:/ {object_id}?fields = location – Tobi

+0

我真的希望通過fql,當我這樣做:「SELECT url,id,type,site FROM object_url WHERE ID = 10151322350549377" 返回{ 「數據」:[{ 「URL」: 「https://foursquare.com/v/baralto/4cc1faf506c25481f6bd8647」, 「ID」: 「10151322350549377」, 「型「:」profile「, 」site「:」foursquare.com「 } ] }但沒有位置:( –