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.
github.com/dilame/instagram-private-api
From npm
npm install instagram-private-api
From github
npm install github:dilame/instagram-private-api
If you find this library useful for you, you can support it by donating any amount
BTC: 1Dqnz9QuswAvD3t7Jsw7LhwprR6HAWprW6
You can find usage examples here
Note for JavaScript users: As of Node v.13.5.0, there isn't support for ESModules and the 'import'-syntax. So you have to read the imports in the examples like this:
import { A } from 'b'
➡ const { A } = require('b')
import { IgApiClient } from './src';
import { sample } from 'lodash';
const ig = new IgApiClient();
// You must generate device id's before login.
// Id's generated based on seed
// So if you pass the same value as first argument - the same id's are generated every time
ig.state.generateDevice(process.env.IG_USERNAME);
// Optionally you can setup proxy url
ig.state.proxyUrl = process.env.IG_PROXY;
(async () => {
// Execute all requests prior to authorization in the real Android application
// Not required but recommended
await ig.simulate.preLoginFlow();
const loggedInUser = await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);
// The same as preLoginFlow()
// Optionally wrap it to process.nextTick so we dont need to wait ending of this bunch of requests
process.nextTick(async () => await ig.simulate.postLoginFlow());
// Create UserFeed instance to get loggedInUser's posts
const userFeed = ig.feed.user(loggedInUser.pk);
const myPostsFirstPage = await userFeed.items();
// All the feeds are auto-paginated, so you just need to call .items() sequentially to get next page
const myPostsSecondPage = await userFeed.items();
await ig.media.like({
// Like our first post from first page or first post from second page randomly
mediaId: sample([myPostsFirstPage[0].id, myPostsSecondPage[0].id]),
moduleInfo: {
module_name: 'profile',
user_id: loggedInUser.pk,
username: loggedInUser.username,
},
d: sample([0, 1]),
});
})();
Feed allows you to get data. Every feed is accessible via ig.feed.feedName
. See nice example and learn how to work with library feeds.
Available feeds key list:
accountFollowers
, accountFollowing
, news
, discover
, pendingFriendships
, blockedUsers
, directInbox
, directPending
, directThread
, user
, tag
, location
, mediaComments
, reelsMedia
, reelsTray
, timeline
, musicTrending
, musicSearch
, musicGenre
, musicMood
, usertags
, saved
Most of the feeds requires initialization parameter, like user pk. Check autogenerated docs, every feed doc link starts with feeds/
and contains constructor with argument if needed.
Repositories implements low-level atomic operations. Any repository method must make at most one api-request. There is repository listing below, so you can get information about methods of each repository from our autogenerated docs.
Keys is a little hints, with it you will be able to get access to repository via ig.key
.
Key | Repository class documentation |
---|---|
account | AccountRepository |
attribution | AttributionRepository |
challenge | ChallengeRepository |
consent | ConsentRepository |
creatives | CreativesRepository |
direct | DirectRepository |
directThread | DirectThreadRepository |
discover | DiscoverRepository |
fbsearch | FbsearchRepository |
friendship | FriendshipRepository |
launcher | LauncherRepository |
linkedAccount | LinkedAccountRepository |
live | LiveRepository |
location | LocationRepository |
locationSearch | LocationSearch |
loom | LoomRepository |
media | MediaRepository |
music | MusicRepository |
news | NewsRepository |
qe | QeRepository |
qp | QpRepository |
tag | TagRepository |
upload | UploadRepository |
user | UserRepository |
zr | ZrRepository |
Services will help you to maintain some actions without calling a couple repositority methods or perform complex things like pre and postlogin flow simulations or photo/video publishing.
Key | Service class documentation |
---|---|
publish | PublishService |
search | SearchService |
simulate | SimulateService |
story | StoryService |
In order to get debug infos provided by the library, you can enable debugging.
The prefix for this library is ig
.
To get all debug logs (recommended) set the namespace to ig:*
.
In node you only have to set the environment variable DEBUG
to the desired namespace.
Further information
In the browser you have to set localStorage.debug
to the desired namespace.
Further information
If you need features that is not implemented - feel free to implement and create PRs!
Plus we need some documentation, so if you are good in it - you are welcome.
Setting up your environment is described here.
instagram-id-to-url-segment - convert the image url fragment to the media ID
FAQs
Unknown package
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.