PicFeed for RSS

Create an RSS feed of a selected Instagram user's recently published media using the v1 API.

[read privacy policy]


Contributors: sahearn
Tags: Instagram, API, RSS


Questions/Comments: sahearn at gmail dot com


Description

Background

While Instagram is great for consuming media on a mobile device, there aren't any options for following a user (and their published media) via an RSS feed. Rather than opening up ten different apps just to see what my friends are up to, I prefer to follow whatever I can via a feed reader (such as Feedly). After creating a similar script for Twitter using their API, I decided to do the same for Instagram. Unfortunately, Instagram API is fairly restrictive. All requests must be authenticated, and (as of Dec 2015) all apps that wish to query other users' content must be reviewed and approved.

What You'll Need

Approach

To use this script, you'll first need your own access token; so register your script and go through those steps for proper authentication.

I modeled my script after some research I found on the IBM DeveloperWorks library, which guided me through the JSON parsing I'd need to perform on the Instagram API response. Past that, I simply needed to extract the user's most recent media (using the appropriate API endpoint) and dropping them into a well-formed RSS/XML file. As I stated in my TweetPull script, this is primarily due to the API's rate limiting - I don't want to get flagged for spamming, so this forces me to schedule the script via cron, instead of risking it banging against Instagram in realtime.

Once the output file is created, I host it so an RSS reader can get to it. If you can't host the result, this will be useless to you.

Also as with TweetPull, I chose to pass the user id to the script as an argument. This means if I want to pull from 5 Instagram users, I have 5 entries in my crontab. (See Installation steps below.)

In general, a lot of improvements can be made here, but it's good enough for a v0.1 release. And I only did it because I'm devoted to RSS and I couldn't find anyone else doing something similar yet.


Download

Latest: v0.1 (Jul 2016) - picfeed.zip

View source: picfeed.php

License: This script is released under the Apache v2.0 License.


Installation

General

  1. Download latest version of PicFeed for RSS package picfeed.zip above
  2. Edit the following parameters:

Usage

  1. Follow Installation steps above
  2. Run the script (typically by cron) with the following:

    5 * * * * php /full/path/to/picfeed.php -u [numerical Instagram user id]

    Note: the single input (-u [userid]) is not the Instagram's user screen name, but rather their numeric ID; go to their page, view source, and search for "id" in the big JSON block.
     
  3. Output file(s) will be "ig-[numerical Instagram user id].xml". Enter that file (with full URL) into your favorite RSS reader. (e.g. http://www.mydomain.com/feeds/ig-[numerical Instagram user id].xml)

Changelog

0.1 [download]


To-do List

No items at this time.

Privacy Policy

When the script is executed, the specified Instagram user's profile will be read in the "basic" and "public_content" contexts. This means that any public-facing content in the user's profile and published media will be processed. The raw response data from the Instagram API is read, and the URL links/references to the most recently published media within that payload are written to a valid XML document. The script owner may store this file on a web host with the intention to be read later by an RSS reader. The file will only contain references to the Instagram user's id, and URL links to content hosted on Instagram. Media files are not read or stored in any way. The data object read from Instagram is destroyed upon script completion.


Updated: 07 Jul 2016