Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
instagrapi
Advanced tools
Library to obtain information from an Instagram account in a friendly and intuitive way
Library to obtain information from an Instagram account in a friendly and intuitive way.
The library works as a wrapper for the basic Instagram API, to abstract long or confusing property names and have a clean and readable data structure.
Created with NodeJS and Typescript, all types are exposed for use. + 💗
npm install instagrapi
<!-- Bundle minify and optimized to production -->
<script src="https://cdn.jsdelivr.net/npm/instagrapi@3/dist/bundle/instagrapi.min.js"></script>
Download the bundle from jsdelivr selecting the
instagrapi.min.js
file and then right click "save as".
First you must get the cookie called "sessionId" by logging in to your instagram account. To do this you must follow these steps:
Ctrl + Shift + I
application
section and then to Cookies
and select on the right hand side sessionId
application
storage
Now you can use the library by instantiating an object and passing the sessionId
as an argument
const { Instagrapi } = require('instagrapi')
const instagrapi = new Instagrapi({
sessionId: process.env.SESSION_ID // Load sessionId from an environment variable
})
instagrapi.getProfile('USERNAME').then(profile => {
console.log(profile.followers) // Numbers followers of instagram account
})
Using typescript and async/await.
import { Instagrapi, TPost, TComment } from 'instagrapi'
const instagrapi = new Instagrapi({
sessionId: process.env.SESSION_ID
})
async function getComments(): Promise<string[] | undefined> {
try {
const post: TPost = await instagrapi.getPost('POST_URL')
const comments: string[] = post.lastComments.map((comment: TComment) => comment.content)
console.log(comments) // Last comments of the post
return comments
} catch (error) {
console.error(error)
}
}
getComments()
getProfile(<USERNAME>)
Get all the profile information of an instagram account. Receives as argument: <USERNAME>
, the username of the
instagram account.
Type of output in typescript:
type TProfile = {
username: string
image: {
standard: string
hd: string
}
qtyPosts: number
followers: number
following: number
name: string
biography: string
externalUrl: string
isBusiness: boolean
isVerified: boolean
isPrivate: boolean
}
getLastPosts(<USERNAME>)
Get the last 12 posts of an instagram account. Receives as argument: <USERNAME>
, the username of the instagram
account.
Type of output in typescript:
type TLastPosts = Array<{
postUrl: string
image: string
video: null | {
url: string
views: number | null
}
content: string | null
likes: number
qtyComments: number
}>
getPost(<POST_URL>):
Get all the details of a post of an instagram account. Receives as argument <POST_URL>
, the url of the post on
instagram.
Type of output in typescript:
type TPost = {
postUrl: string
image: {
standard: string
hd: string
}
video: TVideo | null
content: string | null
likes: number
qtyComments: number
media: Array<TMedia>
author: {
username: string
image: string
qtyPosts: number
followers: number
name: string
isVerified: boolean
isPrivate: boolean
}
lastComments: Array<TComment>
location: null | {
country: string | null
region: string | null
city: string | null
street: string | null
zipCode: string | null
}
date: string
}
MIT © Edixon Piña
FAQs
Library to obtain information from an Instagram account in a friendly and intuitive way
The npm package instagrapi receives a total of 3 weekly downloads. As such, instagrapi popularity was classified as not popular.
We found that instagrapi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.