Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I query public facebook events by location/city?

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!

like image 237
egfconnor Avatar asked Jun 24 '12 21:06

egfconnor


People also ask

How do I search for events in a different city on Facebook?

In the top left corner, you can tap the city name to browse events somewhere else. Note: Depending on the event's privacy setting, people may be able to see if you're interested or going to events in a Feed post, notifications, on the event itself or in the events section of your profile.

How do I filter an event on Facebook?

By clicking or tapping to select a category in the menu on the left side of the page, the search results will filter appropriately. For example, if you want to see events that benefit local charities, click or tap Causes in the "Categories" section. All the events will filter to show you events that benefit charities.


3 Answers

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.

like image 116
cpilko Avatar answered Oct 12 '22 05:10

cpilko


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

like image 21
studgeek Avatar answered Oct 12 '22 04:10

studgeek


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.

like image 3
Master Ace Avatar answered Oct 12 '22 06:10

Master Ace