How can I query public facebook events by location

2019-01-12 20:38发布

问题:

I've been trying to figure out how to do this, and was thinking it wasn't possible, then found this website: (Removed due to a dead link)

You can search by city there and I have no idea how they do it? The normal graph API's don't allow searching for events by location as far as I can see. Any advice/tips/info would be great!

回答1:

Updated 2014-07-02

You can't directly search the Facebook API for events near a location. Since originally giving this answer, the Graph API has made it harder to search for events.

The Elmcity script referenced by the OP does a simple search for a keyword in the event title. Try "Lancaster" for example. You'll get events that have the word Lancaster somewhere in their metadata.

Their query looks something like this:

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

You can also search for a non-location based word in the title like "picnic" and the script returns events.

For the problem of actually finding events near a location, in the current iteration the "venue" field is only a string, so it has no relationship to any Facebook place. Running these query returns nothing:

https://graph.facebook.com/madisonsquaregarden/events
https://graph.facebook.com/108424279189115/events

So using a batched request isn't even a possibility.

According to the documentation FQL seems to be a better solution. In the event documentation, the venue.name column is indexable! Easy, right?

Wrong. When you run this FQL query to find events at some location like this:

 SELECT name, start_time, venue FROM event WHERE CONTAINS("madison square garden")

You find that venue.name isn't populated.

Trying any other variation like:

 SELECT name, start_time, venue FROM event WHERE venue.id = 108424279189115

Throws a "statement not indexable" error.

So while building a "Facebook Events Near Me" is the killer app, the only way that it seems possible is to search for common strings for events near you, get those events, then filter out irrelevant events from the result set.



回答2:

This JavaScript library on GitHub seems like an interesting approach to look at. It uses a places search and then does an events search on those places.
tobilg/facebook-events-by-location-core



回答3:

As of recent. the Events end points have been deprecated due to the privacy issue. Your app will now need to be reviewed first to access events api, when it resumes.



回答4:

Events and points has been deprecated due to privacy issues. Now you have to review your app before you can access events api. After successful approval you can search events.



回答5:

So what you can do is enter "Events", but you need to enter the date, or tomorrow after that. Then, on the right, in your filters, enter the location field, select other, then punch in the location you want.