2014-04-22 1 views
0

Использование fql Я получаю несколько фотографий. Photo стол имеет поле place_id, где на большинстве моих фотографий есть page_id на странице таблицы - никаких проблем с этим. Но фотографии, сделанные с помощью instagram, имеют place_id, но не соответствуют какой-либо странице, когда я проверяю фотографию с помощью facebook: место связывается с четырьмя страницами.ссылки place_id на foursquare?

Мои сомнения: как я могу получить правильную ссылку на foursquare с place_id? Потому что мне нужно знать, где была сделана моя фотография.

Пример:

place_id является '10150673541763630'
фото place link в фейсбуке есть 'https://pt.foursquare.com/v/pra%C3%A7a-da-alegria/4caf06ba39458cfa4fcbf69f'

Спасибо.

ответ

0

Нет действительно уверены, что вы хотите достичь здесь ... Если вы используете API Graph для запроса object_id 10150673541763630, вы получите следующий запрос:

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

я добавил параметр metadata=1, так что вы можете видеть, что это не место, объект, а объект Opengraph типа opengraphobject:playfoursquare:venue вместо:

{ 
    "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()) 

После этого вы можете просмотреть список и запросить каждую фотографию через стандартный графический API, как я показал выше. Затем вы можете найти местоположение ниже data.location в объекте результата.

Или, вы можете использовать либо Batch 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

Tobi это то, что информация, которую я хочу , знаете ли вы, в какой таблице fql он хранится? спасибо –

+0

Как я писал, вам нужно сделать это через стандартные запросы API Графа, а не FQL:/{object_id}? fields = location – Tobi

+0

Я действительно хотел получить fql, когда я делаю: «SELECT url, id, type, site FROM Тип 10151322350549377 " » object_url WHERE ID = 10151322350549377" возвращает { "данные": [{ "URL":: "https://foursquare.com/v/baralto/4cc1faf506c25481f6bd8647", "ID"" «:„профиль“, „сайт“:„foursquare.com“ } ] }, но не место :( –