使用Facebook Graph API按位置搜索公共事件 [英] Search for public events by location using the Facebook Graph API

查看:127
本文介绍了使用Facebook Graph API按位置搜索公共事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助!我正在尝试使用Facebook Graph API按位置搜索公共事件.我已经看到很多帖子说,使用当前版本的Graph API或FQL,这是不可能的.但是,我确实看到具有此功能的站点以及许多FQL解决方法.没有一个对我成功.

Help! I'm trying to search for public events by location using the Facebook Graph API. I've seen many posts saying that this is not possible with the current version of the Graph API out now or FQL. But, I do see sites with this feature as well as many FQL workarounds. None have been successful for me.

以下是我从API请求的搜索参数

Here are my search parameters being requested from the API

/search?q=*&type=event&center=10.4434041,-61.419835&distance=1000

我希望这将是答案,仅因为它似乎涵盖了类型事件和特定位置.但是,我错了,我获得了未来20年免费的三星银河系中相同的营销活动的列表,其中包含30种不同的语言.

It was my hope that this would be the answer, simply because it seems to cover the type event and specific location. But, I was wrong and I get a list of the same marketing event for a free samsung galaxy 20 years into the future in 30 different languages.

因此,我想查询该特定位置的场所(地方),结果证明是成功的,然后从那些场所中获取ID,并逐个查询每个ID,以查看是否有与此特定事件相关的事件场地.我不知道如何用第一个搜索查询的结果进行查询的后半部分,但这是我到目前为止的事情.

So I thought to query for the venue(place) in that specific location, which turned out successful, and then grab the id's from those venues and query each id one by one to see if there are any associated events to that specific venue. I don't know how to go about the second half of the query with the results of the first search query but this is what I have so far.

/search?type=place&q=*&center=10.4434041%2C-61.419835&distance=1000&fields=name,id

返回

{
  "data": [
  {
    "name": "Valid Venue!",
    "id": "740199068928858"
  },
  {
    "name": "Valid Venue!",
    "id": "522158807878843"
  },
  {
    more valid venue data!!
  }
}

我还应该注意,这次地点搜索将给我列出该位置上的所有列出的地点,我知道这是非常糟糕的,并且完全没有效率,但是我全都没有想法.

I should also note that this venue search will give me all listed places in that location, which, I know is VERY bad and completely inefficient but I'm all out of ideas.

我不确定这是否是正确的解决方法,但看来这是我认为可以按位置获取事件的最合理的解决方案.任何指导或根本将不胜感激!

I'm not sure if this is the right path to go down but it seems like the most plausible solution I can think of to get events by location. Any guidance or at all would be greatly appreciated!!

谢谢!

推荐答案

该方法曾经有效(或者,如果您使用v2.0应用,则该方法直到2016年8月7日仍然有效,并且该事件是由具有以下位置/位置的页面创建的:场地设置),如

This used to work (or still works until August 7th 2016 if you have a v2.0 app, and the event was create by a page with a location/venue set) as described in

例如.使用Graph API本身,就不可能在一个查询中搜索附近的事件.

for example. With the Graph API itself, it is not possible to search for nearby events in one query.

您可以做的是

  1. 搜索附近的地方
  2. 查询1.找到的每个地方的事件

请记住,您必须对已通过的事件等进行过滤.不幸的是,这是非常低效的...

Keep in mind that you'll have to filter yourself regarding passed events etc. It's very inefficient unfortunately...

编辑2017-12-20

您可以使用 https://github.com/tobilg/facebook-此用例的事件按位置排列.

这篇关于使用Facebook Graph API按位置搜索公共事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆