1.0.8 • Published 5 years ago

instagram-parser v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Instagram Parser

Author: fasoeu@gmail.com

Search by Hashtag

With this module you can search on Instagram a single hashtag and grab the results. You will get all the image and video links, with their captions, likes and comments' amount.

How to use - examples

From command line

Provide a parameter to the script with the hashtag you wonder to search on IG (./examples/from-cmd.js):

1) Install the module:

$ npm i instagram-parser

2) create index.js file:

/**
    Parse Instagram and store the results into a local file
 */

const fs = require('fs');
const igparser = require('instagram-parser');
const hashtag = process.argv[2] || '';
var requestTimestamp = (new Date()).toISOString().replace(/[\+\-]{1}[0-9]+Z?$/img, '').replace(/[^0-9\.]+/img,'');
const localpath = __dirname+'/'+hashtag+'_'+requestTimestamp+'.json';

try {
    if (hashtag) {
        // Set debug to true to see output in console:
        igparser.debug = true;
        igparser.byHashtag(hashtag, (err, res)=>{
            if (err) {
                throw err;
            }
            fs.writeFile(localpath, JSON.stringify(res,null,2)+"\n", (err)=>{
                if(err){
                    throw err;
                } else {
                    console.log('Done!');
                }
            });
        });
    } else {
        console.log('Please, provide the hashtag to search for.');
    }
} catch (err) {
    console.log(err);
}

3) run the following (and search for the hashtag pappacolpomodoro):

$ node index pappacolpomodoro
1.0.8

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago