Coder Social home page Coder Social logo

ai2010 / instanalytics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hiimim/instanalytics

0.0 2.0 0.0 9 KB

Monitor Instagram accounts without using API

Home Page: http://nbyim.com/monitor-instagram-accounts-without-using-api

Python 100.00%

instanalytics's Introduction

InstAnalytics

About

Each day, this Python script scraps the web version of Instagram, to get the number of posts, followers, following + likes and comments per photo from any public account. The data is then stored in a JSON file (data/InstAnalytics.json) so you can get track its growth.

As I made it to run on my Raspberry Pi, it uses PhantomJS, a lightweight headless browser (which is perfect for a RPi, especially in terms of resources consumption).

For more info, check out my blog post.

Requirements

Before you can run InstAnalytics.py, you will need to install a few Python dependencies.

Note: Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip by default, so you may have pip already. Otherwise, you can install easy_install sudo apt-get install python-setuptools to install pip sudo easy_install pip.

  • BeautifulSoup4, for parsing html: pip install BeautifulSoup4
  • Selenium, for browser automation: pip install Selenium

PhantomJS:

  • On Windows, download the binary from the official website and put it in the same folder than InstAnalytics.py.
  • On OS X Yosemite, the binary provided by the PhantomJS crew doesn't work (selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'). You can either compile it by yourself or download the binary provided by the awesome eugene1g. Then put it in the /usr/local folder.
  • It's the same for Raspbian : compile it and put it in the /usr/bin folder or download the binary provided by the awesome spfaffly.

If you want to built your own binaries, here is the build instructions for PhantomJS.

If you plan to change the browser to Firefox or Chrome, edit the line browser = webdriver.PhantomJS(desired_capabilities=dcap) to browser = webdriver.Firefox() or browser = webdriver.Chrome(). To use Firefox you don't need anything more. For Chrome, first get the webdriver then put it in the same folder than InstAnalytics.py if you are on Windows, or in the /usr/local folder if you are on OS X.

Configuration

Before you run InstAnalytics.py, edit the users = ['yotta_life'] list to add as much as you want public Instagram accounts. It's that simple!

JSON output example

[
    {
        "username": "yotta_life", 
        "date": "2016-04-21", 
        "data": {
            "following": 231, 
            "followers": 649000, 
            "pLikesT": 2029474, 
            "posts": 608, 
            "photos": [
                {
                    "pId": "BEZLlc8sU_v", 
                    "pLikes": 4486, 
                    "pComments": 205
                }, 
                ...
                {
                    "pId": "uuhChFMU92", 
                    "pLikes": 282, 
                    "pComments": 19
                }
            ]
        }
    }
]

The complete output is available here: https://gist.github.com/helloitsim/c3a6ce83e302a1279398b896c1c36ccb.

instanalytics's People

Contributors

hiimim avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.