Gets data from Instagram API, inserts into Elasticsearch and displays via Django.
Due to Sandbox mode limitations (only access to media from max. 20 registered users), this demo only gets the recent media. It could also get the list of tags from Instagram and iterate through recent media from them when in unrestricted mode.
Simple search trough indexed data and displaying the photos.
A client_secrets.json file is needed, with data same as an app registered on Instagram. It should go into utils/
"installed": {
"client_id": "CLIENT_ID",
"client_secret":"CLIENT_SECRET",
"redirect_uris": ["http://www.whatever.com/"],
"auth_uri": "https://api.instagram.com/oauth/authorize",
"token_uri": "https://api.instagram.com/oauth/access_token"
}
You also need Elasticsearch installed (which requires Java) and running. Refer to Elasticsearch documentation for that.
Run utils/crawler.py script which will first authorize you on Instagram. Then, copy the code. On subsequent uses, the access token will be stored in a file inside the utils folder.
Run it in a standard Django way by:
python manage.py runserver