Skip to content

davidmoss/instacane

 
 

Repository files navigation

Instacane

This is a service that pulls tweeted Instagram photos (or anything really) from Twitter, pulls it's relevant Instagram data, and serves them out there for your viewing please. The photos are displayed in a grid and change position with the ebb and flow of Twitter tweets/retweets.

It was made in the hours before Hurricane Irene in 2011 and redeployed for Hurricane Sandy in 2012 by @chris_ackermann and @petersng. This is much of the source code for it, cleaned up, and sanitized for the masses. Please feel free to check it out, run it on your own, and submit pull requests. I'm hoping if this gets deployed again, it will be with improvements from the community.

Here is some of the press about it:


You will need:

  • Python 2.7
  • Memcache
  • MongoDB (Optional)
  • Instagram API token
  • Twitter API consumer key/secret, access token/secret

To fire it up the photo aggregator, you will need these pylibs:

  • python-twitter
  • python-instagram
  • memcache
  • requests
  • pymongo

To install these in your virtualenv:

$ pip install -r requirements.txt

and to create two files:

  • /path/to/instacane/instagram.token - 1 line, containing your Instagram access token.
  • /path/to/instacane/twitter.token - 4 lines, containing your Twitter (in order) consumer key, consumer secret, access token, access token secret.

and run this:

/path/to/instacane/load_photos.py

load_data.py makes the calls to Twitter and Instagram and loads the JSON data into memcache (for use with the web service) and archived into MongoDB.


To fire up the web service, you will need these pylibs:

  • Tornado

and run this:

/path/to/instacane/run_service.py -p <port>

The web service essentially pulls the recent data from memcache, runs it through the Tornado templating engine, and displays it. You can run multiples of this service with different ports behind nginx, Apache, etc for better performance. This has proven to be a pretty lightweight setup and has handled lots of traffic with one instance.

Once started, the site is reachable on your localhost via:

http://localhost:8080

The JSON data is reachable via:

http://localhost:8080/feed

Possible improvements:

  • Better, prettier, more dynamic UI w/no tables!
  • Serve as static page, rather than via Nginx/Tornado.
  • If served as static page, directly upload and serve from S3/Cloudfront, rather than worry about scaling instances/machines.
  • Add support for Instagram video.
  • Add support for Vines?

Released under v2 of the GPL.

Copyright (C) 2013 Chris Ackermann + Peter S. Ng

About

This is the code for instacane.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 68.5%
  • HTML 31.5%