I was looking around for a way to get a user's public Instagram feed as an RSS feed without using the Instagram API when I came across this question on Stack Overflow.
Probably the best way to do this, would be to use the Instagram API. However, I had no desire to sign up for an Instagram account.
Initially, this answer on Stack Overflow suited my needs quite well. However, as fate would have it, Instagram changed its HTML output and the page's JSON data structure changed. Since the idea is quite simple (we're just screen scrapping here) I decided to write my own script. If this works well for you, consider upvoting my answer on Stack Overflow: http://stackoverflow.com/a/25559442/1171790
EDIT August 2017: I no longer support this scipt. The Instagram HTML output of any given user page changes often and it's been a fun game of cat and mouse but I no longer have a need for an Instagram user RSS. If someone else wants to submit a pull request to this Gist that supports the current Instagram output, I'd be happy to merge your changes. Thanks!
EDIT Septemeber 2017: I decided to continue supporting this script, for now. I got a couple emailed requests for support. I added changes and instructions to help people set it up on Heroku.
EDIT March 2018: This script will not be supported anymore but you get the idea - we are scraping the JSON object off of the page with PHP.
EDIT March 2023: Pull requests that work (tests or proof or some sort) will be accepted and merged. Cheers! 🥂
Upload the script to your own server with PHP installed and then call the script via curl
or in your web browser.
Getting a user's Instagram feed as an RSS feed: instarss.php?user=username
Getting an RSS feed of Instagram tags (aka hashtags): instarss.php?hashtag=carshow
Since your RSS reader will be checking for new content on some sort of interval and since Instagram provides the latest 20 photos/videos on a user's homepage, there is a potential for some content to be overlooked. In the event that more than 20 posts have been posted since the script last checked for new content, some content could be missed. Setting your RSS reader to check the instarss.php
script often, will work around this. Alternatively, you can checkout this script which probably handles pagination.
If you'd like to use this script, it's probably easiest to set it up on a Heroku instance.
-
First, clone this repository:
git clone https://gist.github.com/48c46d9fc2913fba3292.git
and thencd
into the project directory. -
Login to Heroku and create a new app.
-
And then login to Heroku via the command line:
heroku login
-
Then add Heroku as a remote:
heroku git:remote -a your-projects-name
-
git push heroku master
You can then access Instarss at a URL like: https://your-projects-name.herokuapp.com/instarss.php?user=snoopdogg
thanks to blitterobject reddit user for resolve this problem.