user-instagram
Advanced tools
Comparing version 1.1.3 to 2.0.0
@@ -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); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
4146
69
48
- Removedcheerio@^1.0.0-rc.3
- Removedboolbase@1.0.0(transitive)
- Removedcheerio@1.0.0(transitive)
- Removedcheerio-select@2.1.0(transitive)
- Removedcss-select@5.1.0(transitive)
- Removedcss-what@6.1.0(transitive)
- Removeddom-serializer@2.0.0(transitive)
- Removeddomelementtype@2.3.0(transitive)
- Removeddomhandler@5.0.3(transitive)
- Removeddomutils@3.1.0(transitive)
- Removedencoding-sniffer@0.2.0(transitive)
- Removedentities@4.5.0(transitive)
- Removedhtmlparser2@9.1.0(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removednth-check@2.1.1(transitive)
- Removedparse5@7.2.1(transitive)
- Removedparse5-htmlparser2-tree-adapter@7.1.0(transitive)
- Removedparse5-parser-stream@7.1.2(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedundici@6.21.0(transitive)
- Removedwhatwg-encoding@3.1.1(transitive)
- Removedwhatwg-mimetype@4.0.0(transitive)