Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

user-instagram

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

user-instagram - npm Package Compare versions

Comparing version 1.1.3 to 2.0.0

src/util.js

4

index.js

@@ -1,6 +0,6 @@

const handle = require("./src/handle");
const handle = require("./src/scrape");
/**
* @param profileInfo { String }
* @param username { String }
*/
module.exports = handle;
{
"name": "user-instagram",
"version": "1.1.3",
"version": "2.0.0",
"description": "Get user data and feed content by scraping Instagram's user page. No OAuth needed.",

@@ -11,11 +11,9 @@ "main": "index.js",

"Instagram",
"API",
"Scrape",
"Instagram",
"scraper",
"webscraping"
"Instagram API",
"Instagram user",
"scrapping"
],
"repository": {
"type": "git",
"url": "https://github.com/EdouardCourty/node-instagram-scraper"
"url": "https://github.com/EdouardCourty/user-instagram"
},

@@ -25,5 +23,4 @@ "author": "Edouard Courty",

"dependencies": {
"axios": "^0.19.2",
"cheerio": "^1.0.0-rc.3"
"axios": "^0.19.2"
}
}

@@ -21,5 +21,3 @@ # Node-Instagram

getInstaProfile("edouard_courty")
.then(userData => {
console.log(userData.user)
})
.then(console.log)
.catch(console.error);

@@ -33,14 +31,15 @@ ```

{
"id": "<userId>",
"profileLink": "https://www.instagram.com/edouard_courty",
"biography": "<Biography>",
"subscriberCount": 444,
"subscribtions": 362,
"postCount": 27,
"fullName": "Edouard Courty",
"username": "edouard_courty",
"isPrivate": false,
"isVerified": false,
"fullName": "Edouard Courty",
"bio": "<userBio",
"id": "<userId>",
"avatar": "<avatarThumbnailLink>",
"avatarHD": "<HDAvatarLink>",
"profilePic": "<ProfilePicThumbnailLink>",
"profilePicHD": "<HDProfilePicLink>",
"postsCount": 27,
"posts": []

@@ -47,0 +46,0 @@ }

@@ -1,56 +0,52 @@

const cheerio = require("cheerio");
const axios = require("axios");
const { normalizeUrl } = require("../src/util");
module.exports = body => {
return new Promise((resolve, reject) => {
let $ = cheerio.load(body);
let scripts = $("script[type='text/javascript']"), graphql;
try {
graphql = JSON.parse(
scripts[3].children[0].data
.replace("window._sharedData = ", "")
.replace("};", "}")
).entry_data.ProfilePage[0].graphql.user;
} catch (e) {
return reject(e)
}
return resolve({
"profileLink": "https://www.instagram.com/".concat(graphql.username),
"subscriberCount": graphql.edge_followed_by.count,
"subscribtions": graphql.edge_follow.count,
"postCount": graphql.edge_owner_to_timeline_media.count,
"username": graphql.username,
"isPrivate": graphql.is_private,
"isVerified": graphql.is_verified,
"fullName": graphql.full_name,
"bio": graphql.biography,
"id": graphql.id,
"avatar": graphql.profile_pic_url,
"avatarHD": graphql.profile_pic_url_hd,
"posts": graphql.edge_owner_to_timeline_media.edges.map(edge => {
module.exports = username => {
return new Promise(async resolve => {
let link = normalizeUrl(username);
const GQL = await axios.get(link);
let user = GQL.data.graphql.user;
resolve(JSON.stringify({
link: link,
id: user.id,
biography: user.biography,
subscribersCount: user.edge_followed_by.count,
subscribtions: user.edge_follow.count,
fullName: user.full_name,
highlightCount: user.highlight_reel_count,
isBusinessAccount: user.is_business_account,
isRecentUser: user.is_joined_recently,
accountCategory: user.business_category_name,
isPrivate: user.is_private,
isVerified: user.is_verified,
profilePic: user.profile_pic_url,
profilePicHD: user.profile_pic_url_hd,
username: user.username,
postsCount: user.edge_owner_to_timeline_media.count,
posts: user.edge_owner_to_timeline_media.edges.map(edge => {
return {
"id": edge.node.id,
"captionText": edge.node.edge_media_to_caption.edges.length === 0
? null
: edge.node.edge_media_to_caption.edges[0].node.text,
"shortcode": edge.node.shortcode,
"link": `https://www.instagram.com/p/${edge.node.shortcode}`,
"commentsCount": edge.node.edge_media_to_comment.count,
"timestamp": edge.node.taken_at_timestamp,
"likes": edge.node.edge_liked_by.count,
"location": edge.node.location || null,
"picture": {
"url": edge.node.thumbnail_src,
"thumbnail_150": edge.node.thumbnail_resources[0].src,
"thumbnail_240": edge.node.thumbnail_resources[1].src,
"thumbnail_320": edge.node.thumbnail_resources[2].src,
"thumbnail_480": edge.node.thumbnail_resources[3].src,
"thumbnail_640": edge.node.thumbnail_resources[4].src
},
"isVideo": edge.node.is_video
id: edge.node.id,
shortCode: edge.node.shortcode,
dimensions: edge.node.dimensions,
imageUrl: edge.node.display_url,
isVideo: edge.node.is_video,
caption: edge.node.edge_media_to_caption.edges[0].node.text,
commentsCount: edge.node.edge_media_to_comment.count,
commentsDisabled: edge.node.comments_disabled,
timestamp: edge.node.taken_at_timestamp,
likesCount: edge.node.edge_liked_by.count,
location: edge.node.location,
childs: edge.node.edge_sidecar_to_children ? edge.node.edge_sidecar_to_children.edges.map(edge => {
return {
id: edge.node.id,
shortCode: edge.node.shortcode,
dimensions: edge.node.dimensions,
imageUrl: edge.node.display_url,
isVideo: edge.node.is_video,
}
}) : []
}
})
})
})
}) || []
}));
});
};

@@ -1,5 +0,3 @@

const scrape = require("../index");
scrape("edouard_courty")
require("../index")("edouard_courty")
.then(console.log)
.catch(console.error);
.catch(console.error);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc