/Pyctogram

A scrapper & web viewer for Instagram, written in Python.

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

๐Ÿ“ท Pyctogram

A scraper & viewer for Instagram, written in Python.

โ“ Whatโ€™s the deal?

Due to various gripes I have with Instagram, I am deleting my account. But there are many of my friends who still use it, and I want to keep on looking at their pictures.

This project aims to create a simple way to see my friendโ€™s latest posts on my computer. The code may be adapted to work on some web hosts or cloud solutions, but itโ€™s still pretty much in development so proceed with care.

Itโ€™s my first real coding project. Iโ€™m a webdesigner who dabbles in Python, and I wanted to scratch an itch. I donโ€™t know anything about software architecture and very little about databases. If you have suggestions for better, nicer, cleaner ways of doing things, please open an issue!

๐Ÿ— How it works

The code is in Python 3.6. It uses Flask, BeautifulSoup, sqlite3.

The scraping can be done regularly (with a cron), or called by the user. The script visits the profile pages of the Instagram users listed, and saves the info in the database. The images are not saved on disk at this point. Of course, if an Insatgram profile is hidden, no info can be saved.

A Flask-based web app lets you browse the saved info, as an image feed (much like an Instagram feed, in the right order and without the ads), as a user profile, or as a specific media page. Thereโ€™s also the possibiltiy to Save (and Forget) some media, in which case the app saves the image on the disk.

โš— How to install it

After cloning the repo, install Python virtualenv and packages:

$ cd Pyctogram
$ make install

When itโ€™s done, initialize the database and run the server:

$ make init-db
$ make serve

And open a browser page to http://127.0.0.1:5000/.

On production, you can run the server with this command (works with Gunicorn)

$ make run

โš— How to use it

Add contacts

You must register to access the account importer.

After registration, you can add accounts to the default feed by importing connections.json file from your Instagram Data Archive.
You can also add accounts from a text file or directly on the application.

Get accounts media

To update accounts media, you can run the following command:

$ make update-media

It updates all accounts regardless of users or lists (recommanded way to update feeds, can be done with a cron).

You can also update media from the web interface for the fedd or a list (not recommanded yet, if the feed/list has a lot of contacts).

๐Ÿ›  To Do

  • ๐Ÿ–ผ Display the "Sidecar" objects (when thereโ€™s many photos in a single post)
  • ๐Ÿ‘ Display latest likes and comments on Media view Following changes by Instagram, it wonโ€™t work.
  • ๐Ÿ“‡ Importing Instagram-exported accounts lists
  • โฌ Calling the scraper from the web interface (with a nice Progress Bar component)
  • Optimize the scraper performances
  • ๐ŸŽช Better Bulma Customization
  • More emoji
  • ๐Ÿ–– Some JS to help with the navigation (j, k, l, like on Flickr)
  • ๐ŸŒŠ DRY the templates
  • ๐Ÿšš Easy Install, esp. on web hosts
  • ๐Ÿ“„ Lists ! Like Twitter lists, with the possibility to call for a scrape for a specific list
  • ๐Ÿ“” Albums
  • ๐Ÿ“ฒ Webapp-ify (keep the app on a server, but allow the webapp to download the saved pictures on the phone, to keep a feed of saved photos offline)
  • ๐Ÿ™ˆ โ€œHide from feedโ€ if you want a contact to appear in lists, but not in your main feed
  • Configuration for "production" environnements

๐Ÿ“ƒ Copyrights and License

The Instagram copyrights and brand belong to Facebook, Inc.

Unless otherwise specified, this code is copyright 2018 Joachim Robert and released under the GNU Affero General Public License v3.0. Learn more about this license : https://choosealicense.com/licenses/agpl-3.0/

This work uses code from: