instagram-parser
v1.0.8
Published
Instagram Parser
Downloads
11
Readme
Instagram Parser
Author: [email protected]
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
):
- Install the module:
$ npm i instagram-parser
- 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);
}
- run the following (and search for the hashtag
pappacolpomodoro
):
$ node index pappacolpomodoro