Create RSS Feed of Runkeeper Actvities
When I first became a Runkeeper user I was content with having my activities available on the Runkeeper website only. Once I started running regularly and started to talk with other runners I was eventually asked if my activities were available at any location online. In my mind I thought for sure that Runkeeper would have a simple RSS feed of my activities. I had never looked for a feed before because I was posting the activities and did not feel a need to track them. I was shocked to find that there was no RSS feed and that since the beginning runners had been asking for this feature. There is no easier way to share activities with other runners than giving them an RSS feed of your activities.
I looked around to see if anyone else had already written something to build an RSS feed. While I found a couple folks had tinkered with it, they were either not doing enough or too much. So I decided to write a PHP script that would scrape the Runkeeper activities and build an RSS feed with a fairly barebones PHP installation. I am using PHP 5.3, but I suspect this would work with some other versions of PHP as well. The feed that my script builds is here : http://scott.buffington.me/runkeeper.xml
Because we are scraping the Runkeeper site, I highly recommend you either manually execute this script and redirect it to a file after an activiity is posted or do what I did and setup a cronjob to call the script. I have mine execute twice a day after times I commonly run. Be respectful to the Runkeeper website, if not, you may get your script blocked. There are only three variables that you need to set at the top of the script, those being your Runkeeper user ID, your email address and your name. Otherwise this should work for anyone that has made their activities public. This script out of the box will grab your last 12 activities, scrape the json file associated with each of the activities and build an informative RSS feed with a direct link to each activity. I could have included more, there is a lot of info in each of the json files associated with each activity, but I thought what I included was just enough for an RSS feed.
Note: Running this script from the command line and redirecting the output to an XML file is the intended use of this script. If you run it from the browser, it will return to the browser after it scrapes Runkeeper. This is slow and optimally not how this script was intended to be used. For testing purposes, running in a browser is fine.
Download : runkeeper.php






