Bradley Priest

Hacking the Foursquare API for fun and profit?? 26 Mar 2012

So I have a housemate who has a certain fascination with burgers. His favourite ones seem to come from the local BurgerFuel.

For 12 months he was the Foursquare mayor of Burgerfuel Parnel, eating lunch their every second day (healthy right!!). Luckily they had a great two for one deal for the mayor so he always had half price burgers.

However, after a 4 month OE surprisingly he was ousted. Now that he’s back and into his habits again, it seems he just can’t quite get the mayorship back.

So I thought I’d give him a bit of help.

Here’s a quick little ruby script I wrote, use at your own risk, I can almost guarantee it’s against their ToS.

Firstly log in to Foursquare and head to to register a new consumer. You can fill in anything for the website and url, make sure to record the callback url though.

Open your console by running irb -r ./foursquare_bot.rb

Run FoursquareBot.get_oauth(client_id, callback_url) to get a url to visit. Authenticate with Foursquare and we’re good to go, just copy down the code parameter from the url you get redirected to.


Now you can checkin whenever you like with this one liner.

Next step is to make it a daemon and we’re ready to go.

blog comments powered by Disqus