facebook - 过去两年中给定位置的所有 facebook 事件列表

标签 facebook facebook-graph-api facebook-fql

我想做什么

我正在尝试提取 2012 年和 2013 年在给定城市发生的所有 public facebook 事件的列表。此外,对于每个事件,我想提取以下内容:

  • 事件名称
  • 事件说明
  • 日期
  • 地点
  • 参加/可能/拒绝的人数

到目前为止我尝试了什么

我一直在图资源管理器中尝试以下查询

search?q={Oslo}& [type={event}](#searchtypes)

我暂时忽略了日期范围限制。我想我可以稍后解决这个问题。

问题

这是列出状态更新(故事)、地点和其他所有内容,并将其作为 JSON 对象返回。但是,这不会为我提供我需要的所有数据字段。有什么想法吗?

旁注

我已经尝试查看 FQL,但显然不能进行这样的搜索? (如果可以,请随时提供帮助)。我得到的最接近的是:

SELECT eid FROM event_member WHERE uid IN 
(SELECT page_id FROM place WHERE  
 distance(latitude, longitude, "37.76", "-122.427") < 1000)

但这只会给我 future 的事件。也许它也能让我回顾过去?

最佳答案

搜索您未以任何方式链接到的公共(public)对象(没有参与,没有邀请)只能通过 Graph Search API 完成,而不能使用 Graph API 或 FQL。

目前,this is the only documentation for Graph Search .您会发现此 API 没有提供太多可能性,因此如果您想要实现您的目标,您将不得不拼凑一些东西。没有任何直接的方法可以做到这一点。

如果我们收集有关事件的信息,这几乎就是我们所拥有的一切:

Search Types

Events: https://graph.facebook.com/search?q=conference&type=event

Fields

You can restrict the fields returned by these searches using the ?fields= URL parameter, in the same way you can when reading other objects. For example, to get only the names of events, you can do the following:

Event Names: https://graph.facebook.com/search?fields=name&q=conference&type=event

Time

When searching for public posts or posts on the user's News Feed, you can page over the results by using the since, until and limit parameters. since and until both accept a unix timestamp. When paging back in time, you should use until in conjunction with limit where until is the unixtime value of the created_time field in the last object returned by your previous query. When paging forward in time you should set since to be the unixtime value of the created_time field in the first object returned by your previous query. Please note, you can only search about 1 to 2 weeks back in the News Feed.

接下来要知道的是,结果集由其中一个字段包含您要查找的字符串 (q=Oslo) 的事件组成。因此,“Oslo”可能会出现在消息、描述中,可能是位置字段中的幸运,也可能是时区字段中的不幸。

然后您将不得不“手动”过滤掉结果。您可能只搜索包含“Oslo”的事件,然后检查该位置是否确实包含“Oslo”。或者,如果您想轻松查找具有特定位置的事件,我建议您搜索格式为 “City, Country”的字符串",因为这就是 Facebook 格式化城市的方式。所以你可以这样做:

search?fields=location&q="Oslo, Norway"&type=event&since=1356994800

1356994800 是从那时起您要检索事件的 unixtime。

可能的结果:

{
  "data": [
    {
      "location": "Oslo, Norway", 
      "id": "211893915563330", 
      "start_time": "2022-02-08T00:00:00"
    }, 
    {
      "location": "Lillestrøm, Norway", 
      "id": "641379122561097", 
      "start_time": "2015-09-06T09:00:00+0200"
    }, 
    {
      "location": "Oslo, Norway", 
      "id": "1434492323451716", 
      "start_time": "2014-11-06T20:45:00+0100"
    }, 
    {
      "location": "Oslo, Norway", 
      "id": "563423357073321", 
      "start_time": "2014-09-20"
    }, 

    ...

    {
      "location": "Oslo, Norway", 
      "id": "628230923890648", 
      "start_time": "2013-01-16T19:00:00+0100"
    }
  ],
}

然后,或许可以使用 Google Maps API 来查明找到的位置是否确实靠近奥斯陆。 IE。 “Lillestrøm, Norway”离它很近。

关于facebook - 过去两年中给定位置的所有 facebook 事件列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21286441/

相关文章:

ios - 我们如何使用 facebook graph api 获取用户的生日?

facebook - tfbnw.net 电子邮件地址是否可以用于 facebook 登录

facebook-graph-api - Facebook 的 Graph API 调用限制是多少?

facebook - 如何检索标记某人的所有 Facebook 照片

facebook-graph-api - 如何获得 Facebook 页面的 Facebook 点赞数?

javascript - 单击按钮时如何退出 native 应用程序?

php - 移动应用程序如何使用 API 并证明其要修改的 Facebook ID 已在 Facebook 上登录并获得授权?

facebook - 在 Facebook Messenger 中发送位置

java - 如何使用 Jersey Client 将 HTTP 400 响应解析为 Java 类?