instagram-scrape-account-stats
Version:
scrape public Instagram data w/out API access
40 lines (35 loc) • 989 B
JavaScript
// Generated by CoffeeScript 1.9.3
(function() {
var getAccountStats, request;
request = require('request-promise');
getAccountStats = function(arg) {
var uri, username;
username = arg.username;
if (username == null) {
throw new Error('A username needs to be passed');
}
uri = "https://instagram.com/" + username + "/?__a=1";
return request.get({
uri: uri
}).then(function(resp) {
var data;
data = JSON.parse(resp).user;
return {
description: data.biography,
followers: data['followed_by'].count,
following: data.follows.count,
isExplicit: false,
isPrivate: data['is_private'],
isVerified: data['is_verified'],
name: data['full_name'],
userId: data.id,
username: data.username,
posts: data.media.count,
website: data['external_url']
};
});
};
module.exports = {
getAccountStats: getAccountStats
};
}).call(this);