Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of all facebook events in a given location in the last two years

What I am trying to do

I am trying to extract a list of all public facebook events that have happened in a given city in 2012 and 2013. Furthermore for each of them, I want to extract the following:

  • event name
  • event description
  • date
  • location
  • number of people on attending/maybe/declined

What I have tried so far

I have been trying the following query in graph explorer

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

I have ignored the date range constraint for now. I figure that I can fix that later.

The problem

This is listing status updates (stories), places and everything else, and returning it as JSON objects. However, this won't provide with me with all the data fields that I require. Any ideas?

Sidenote

I have tried looking into FQL but apparently that cannot do a search like this? (If it can, feel free to help out). The closest I got was this:

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

But this only gives me events in the future. Maybe if it allowed me to look in the past too?

like image 823
Arnab Datta Avatar asked Jan 22 '14 15:01

Arnab Datta


People also ask

How do I search Facebook events by location?

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.

Why can't I find events on Facebook?

Facebook has disabled event use for all posting platforms at the moment. Facebook has not communicated any sort of ETA on when or if events will be back, so we are sort of accepting this as the new normal for the time being. You are able to schedule posts to business pages, business groups, and private groups.

How do I find events I've been invited to on Facebook?

Events you've been invited to or responded to as "Interested" appear under the header "Your Events." You'll also see "Events You May Like," "Popular With Friends," "Sports Events," "Recently Announced," and "Movies Near You." You can also tap the categories down here to filter your events list.

How many people have been logged out of Facebook?

The vulnerability on the site is believed to have been in existence since July 2017. In response, Facebook logged out 90 million users across all platforms and asked them to log in again and reset their passwords. The “View As” feature was temporarily disabled.

How do I find events to attend?

You can use a mobile or desktop web browser to find events. Log in if prompted. If you're already logged in, you can skip this step. Click or tap Events. You'll see this in the menu on the left side of the page under the header "Explore." You'll immediately see a list of upcoming events that are near you or your friends have responded to.

How do I change the location of my event page?

You can change the location by clicking or tapping a different area in the menu on the left side of the page. You can click on an event to see more details and to mark your interest/intent to attend. By clicking or tapping to select a category in the menu on the left side of the page, the search results will filter appropriately.


2 Answers

Searching through public objects which you aren't linked to in any way (no participation, no invitation) can only be done through the Graph Search API, not with the Graph API nor FQL.

Currently, this is the only documentation for Graph Search. You will see that this API doesn't offer much possibilities, so if you want to achieve your goal, you will have to cobble something together. There is not any direct way to do this.

If we gather what is being told about events, this is pretty much everything we have:

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.

The next thing to know is that the result set is composed of the events for which one of their fields contains the string you are looking for (q=Oslo). So, "Oslo" may appear in either the message, in the description, by luck in the location field and by misfortune in the timezone field.

You will then have to filter out the results "manually". You might just search for events containing "Oslo" and then check if the location indeed contains "Oslo. Or if you easily want to find events with a specific location, I advice you to search for strings formatted as "City, Country", because this is how Facebook format cities. So you might just do:

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

Where 1356994800 is the unixtime since then you want to retrieve events.

Possible result:

{
  "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"
    }
  ],
}

Then, perhaps use the Google Maps API to find out if the found locations are indeed close to Oslo. I.e. "Lillestrøm, Norway" is quite close from it.

like image 67
Stéphane Bruckert Avatar answered Oct 01 '22 03:10

Stéphane Bruckert


Looks like FQL can give you the desired result. This FQL (which is extension to what you started) will show you all events between 2012 and 2013 with the data about the event you wanted:

select 
    eid, 
    name, 
    description, 
    location, 
    all_members_count, 
    attending_count, 
    unsure_count, 
    not_replied_count, 
    declined_count, 
    start_time, 
    end_time,
    venue 
from 
    event 
where     
    eid in 
    (
        select 
            eid, 
            start_time 
        from 
            event_member 
        where 
            uid in 
            (
                select 
                    page_id 
                from 
                    place 
                where 
                    distance(latitude, longitude, "37.76", "-122.427") < 1000
            ) and 
            start_time > "2012-01-01"
    ) and 
    end_time < "2013-01-01" and 
    end_time <> 'null' 

And this how one of the results I got for running this query:

{
  "eid": 170775033066718, 
  "name": "Lavender Diamond at The Chapel - Dec 11", 
  "description": "Get tickets: http://ticketf.ly/SUb4w9\nDetails: http://www.thechapelsf.com/event/184715/\n\nVERY SPECIAL GUEST WILL BE ANNOUNCED DAY OF SHOW", 
  "location": "The Chapel", 
  "all_members_count": 92, 
  "attending_count": 30, 
  "unsure_count": 3, 
  "not_replied_count": 59, 
  "declined_count": 4, 
  "start_time": "2012-12-11T20:00:00", 
  "end_time": "2012-12-12T00:00:00", 
  "venue": {
    "street": "", 
    "city": "", 
    "state": "", 
    "country": "", 
    "latitude": 37.760503799154, 
    "longitude": -122.42123452518, 
    "id": 113634312122520
  }
}
like image 20
sromku Avatar answered Oct 01 '22 02:10

sromku