Giter VIP home page Giter VIP logo

facebook-events-by-location's Introduction

Search Facebook events by location (as a REST)

Based in tobilg - https://github.com/tobilg/facebook-events-by-location (Node.js)

A PHP-based REST-api to get public Facebook events by location. It can be used as a starting point for an location-based app for example.

As Facebook has discontinued the FQL query API for all apps created after 2014-04-30, it has gotten much more complicated to get public Facebook events by passing a location.

This implementation uses regular Facebook Graph API calls in a three-step approach to get the events:

  1. Search for places in the radius of the passed coordinate and distance (/search?type=place&q=*&center={coordinate}&distance={distance})
  2. Use the places to query for their events in parallel (/?ids={id1},{id2},{id3},...)
  3. Unify, filter and sort the results from the parallel calls and return them to the client

###Known limitations

  • The Graph API has some "instabilities" with search results. It's possible that the amount of results returned can vary between calls within seconds
  • Undocumented usage of the q parameter (q=* produced more results than q= or just omitting the q parameter)
  • The /search endpoint "magically" limits the number of results, independent from the distance used (larger distance doesn't guarantee more results) plications of host networking).

##API The basic endpoint is index.php, you should do the uri by your self at your service, like /events

###Query paramenters Mandatory querystring are the following:

  • lat: The latitude of the position/coordinate the events shall be returned for
  • lng: The longitude of the position/coordinate the events shall be returned for
  • distance: The distance in meters (it makes sense to use smaller distances, like max. 2500)
  • access_token: The App Access Token to be used for the requests to the Graph API

Non-mandatory parameters

  • sort: The results can be sorted by time, distance, venue or popularity. If omitted, the events will be returned in the order they were received from the Graph API

###Results The response will be application/json and contain an events property containing the array of event objects, as well as a metadata property with some stats. See below for an example.

###Sample call

http://localhost/index.php?lat=40.710803&lng=-73.964040&distance=1000&sort=venue&access_token=YOUR_APP_ACCESS_TOKEN (make sure you replace YOUR_APP_ACCESS_TOKEN with a real access token!)

###Sample output (shortened)

{
    "events": [
        {
            "venueId": "460616340718401",
            "venueName": "Baby's All Right",
            "venueCoverPicture": "https://scontent.xx.fbcdn.net/hphotos-xfa1/t31.0-8/s720x720/12265652_847575375355827_6601509754180711535_o.jpg",
            "venueProfilePicture": "https://scontent.xx.fbcdn.net/hprofile-xft1/v/t1.0-1/p200x200/1480734_642185745894792_5820988503650852577_n.png?oh=fc70de542d587b32e7a8a9183ddb0560&oe=56E4082D",
            "venueLocation": {
                "city": "Brooklyn",
                "country": "United States",
                "latitude": 40.70998,
                "longitude": -73.9634705,
                "state": "NY",
                "street": "146 Broadway",
                "zip": "11211"
            },
            "eventId": "1671296009750385",
            "eventName": "Baby's All Basel | Dec 2 - 6 | Baby's All Right Miami Pop Up",
            "eventCoverPicture": "https://scontent.xx.fbcdn.net/hphotos-xpa1/v/t1.0-9/s720x720/12249784_1002625069800744_6143497234204516409_n.png?oh=6e5b3eaa2a369d819d160560173cdbea&oe=56E61E88",
            "eventProfilePicture": "https://scontent.xx.fbcdn.net/hphotos-xpa1/v/t1.0-0/c120.0.200.200/p200x200/12249784_1002625069800744_6143497234204516409_n.png?oh=9bc7c7dcd65934ab74010a890d9ac070&oe=56F5E8D3",
            "eventDescription": "POPLIFE Presents:\n\nBABY'S ALL BASEL\n\nBrooklyn's Baby's All Right is touching down in Miami for a week full of live music & parties!\n\nGet involved in all the fun:\nhttp://epop.life/BabysMiami\n\n21+ \n\n#BabysMiami",
            "eventStarttime": "2015-12-02T17:00:00-0800",
            "eventDistance": "103",
            "eventTimeFromNow": 884065,
            "eventStats": {
                "attendingCount": 143,
                "declinedCount": 0,
                "maybeCount": 96,
                "noreplyCount": 1117
            }
        },
        ...
    ],
    "metadata": {
        "venues": 350,
        "venuesWithEvents": 7,
        "events": 23
    }
}

facebook-events-by-location's People

Contributors

pedrogabriel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

facebook-events-by-location's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.