Created
February 8, 2012 02:43
-
-
Save bialikover/1764734 to your computer and use it in GitHub Desktop.
a little snippet to fetch events in fb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var time = new Date(); | |
FB.api("/fql",{q: | |
{'query0':'SELECT uid2 from friend WHERE uid1 = me() LIMIT 2', | |
'query1':'SELECT eid from event_member WHERE uid IN (SELECT uid2 FROM #query0) AND rsvp_status="attending"', | |
'query2':'SELECT eid, name, description, location, venue, start_time FROM event WHERE eid IN (SELECT eid FROM #query1)' //request solo el primer amigo para fines practicos | |
}}, | |
function(response){ | |
var events= response.data[2].fql_result_set; | |
for (var i = 0; events.length > i ; i++){ | |
t = new Date(events[i].start_time * 1000); | |
if(time <= t){ | |
if(events[i].venue.latitude != null){ | |
console.log(i+" id: "+events[i].eid+ | |
" evento: "+events[i].name+ | |
" latitud: "+events[i].venue.latitude+ | |
" longitud: "+events[i].venue.longitude+ | |
" empieza: "+t.toDateString()); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment