{"id":13622188,"url":"https://github.com/dilame/instagram-private-api","last_synced_at":"2025-04-15T05:34:02.923Z","repository":{"id":37270067,"uuid":"60772233","full_name":"dilame/instagram-private-api","owner":"dilame","description":"NodeJS Instagram private API SDK. Written in TypeScript.","archived":false,"fork":false,"pushed_at":"2024-08-09T15:15:55.000Z","size":7555,"stargazers_count":5982,"open_issues_count":383,"forks_count":1141,"subscribers_count":170,"default_branch":"master","last_synced_at":"2024-11-05T16:44:30.877Z","etag":null,"topics":["instagram","instagram-api","instagram-client","instagram-feed","instagram-private-api","instagram-scraper","instagram-sdk"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dilame.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-09T12:14:48.000Z","updated_at":"2024-11-05T15:08:48.000Z","dependencies_parsed_at":"2023-02-08T16:16:24.839Z","dependency_job_id":"3af3cd4e-4cea-450a-8ed2-4bd293f90ee5","html_url":"https://github.com/dilame/instagram-private-api","commit_stats":{"total_commits":1071,"total_committers":112,"mean_commits":9.5625,"dds":0.7591036414565826,"last_synced_commit":"3a153c4e807049e95d72af67e316d432c2fd1577"},"previous_names":["huttarichard/instagram-private-api"],"tags_count":143,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilame%2Finstagram-private-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilame%2Finstagram-private-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilame%2Finstagram-private-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilame%2Finstagram-private-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dilame","download_url":"https://codeload.github.com/dilame/instagram-private-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223661417,"owners_count":17181666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["instagram","instagram-api","instagram-client","instagram-feed","instagram-private-api","instagram-scraper","instagram-sdk"],"created_at":"2024-08-01T21:01:15.371Z","updated_at":"2025-04-15T05:34:02.916Z","avatar_url":"https://github.com/dilame.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","📦 Legacy \u0026 Inactive Projects","instagram","Instagram api"],"sub_categories":[],"readme":"# NodeJS Instagram private API client\n\n![logo](https://cloud.githubusercontent.com/assets/1809268/15931032/2792427e-2e56-11e6-831e-ffab238cc4a2.png)\n\n[![Telegram Chat](https://img.shields.io/badge/telegram-join%20chat-informational.svg)](https://t.me/igpapi)\n[![npm](https://img.shields.io/npm/dm/instagram-private-api.svg?maxAge=600)](https://www.npmjs.com/package/instagram-private-api)\n[![npm](https://img.shields.io/npm/l/instagram-private-api.svg?maxAge=600)](https://github.com/huttarichard/instagram-private-api/blob/master/LICENSE)\n[![Join the chat at https://gitter.im/instagram-private-api/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/instagram-private-api/Lobby)\n\n---\n\n# Next Major Version\n\n[Nerix](https://github.com/Nerixyz) and I are excited to announce the next 3.x.x version of this library.\nIt features an extended list of capabilities and is a significant release.\nWe have substantially expanded the functionality and possibilities.\nThe library has transformed into a monorepository and is now a set of libraries connected in an ecosystem.\nIt consists of:\n\n- Android API\n- Web API\n- FBNS, Realtime\n\nWe've made some design decisions and simplified the state management process.\nNow, you can easily create a snapshot of the account state, save it in persistent storage, and restore a 1-to-1 copy with just one function call.\nWith new realtime features, you can listen for new direct messages, notifications, and other events.\n\nYou can take a look at the type documentation for the next version by following this link – [https://docs.igpapi.com](https://docs.igpapi.com/)\n\nThe new version is hosted in a private repository and access is paid.\nMembers receive exhaustive support for the entire integration process.\n\nContact me in [telegram](https://t.me/bowzee) or [email](mailto:dilame.bowzee@gmail.com) for details.\n\n# Table of Contents\n\n- [Install](#install)\n- [Support us](#support-us)\n- [Examples](#examples)\n- [Basic Concepts](#basic-concepts)\n  - [Feeds](#feeds)\n  - [Repositories](#repositories)\n  - [Services](#services)\n- [Contribution](#contribution)\n- [Useful Links](#useful-links)\n  - [Special Thanks](#special-thanks)\n  - [Thanks to Contributors](#thanks-to-contributors)\n  - [End User License Agreement (EULA)](#end-user-license-agreement-eula)\n\n# Install\n\nFrom npm\n\n```\nnpm install instagram-private-api\n```\n\nFrom github\n\n```\nnpm install github:dilame/instagram-private-api\n```\n\nThis package uses [`url-regex-safe`](https://www.npmjs.com/package/url-regex-safe) ([GitHub](https://github.com/spamscanner/url-regex-safe)) to check for links when sending direct messages.\nBy default, the **safe** regex engine [`re2`](https://github.com/uhop/node-re2) is **not** installed.\n⚠ It's highly recommended for you to install `re2` by running `npm install re2`, else you _will_ be vulnerable to [CVE-2020-7661](https://nvd.nist.gov/vuln/detail/CVE-2020-7661).\n\n# Support us\n\nIf you find this library useful for you, you can support it by donating any amount\n\nBTC: 1Dqnz9QuswAvD3t7Jsw7LhwprR6HAWprW6\n\n# Examples\n\nYou can find usage examples [here](examples).\n\n_Note for JavaScript users:_\nAs of Node v.13.5.0, there isn't support for ESModules and the 'import'-syntax.\nSo you have to read the imports in the examples like this:\n\n`import { A } from 'b'` ➡ `const { A } = require('b')`\n\n```typescript\nimport { IgApiClient } from 'instagram-private-api';\nimport { sample } from 'lodash';\n\nconst ig = new IgApiClient();\n// You must generate device id's before login.\n// Id's generated based on seed\n// So if you pass the same value as first argument - the same id's are generated every time\nig.state.generateDevice(process.env.IG_USERNAME);\n// Optionally you can setup proxy url\nig.state.proxyUrl = process.env.IG_PROXY;\n(async () =\u003e {\n  // Execute all requests prior to authorization in the real Android application\n  // Not required but recommended\n  await ig.simulate.preLoginFlow();\n  const loggedInUser = await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);\n  // The same as preLoginFlow()\n  // Optionally wrap it to process.nextTick so we dont need to wait ending of this bunch of requests\n  process.nextTick(async () =\u003e await ig.simulate.postLoginFlow());\n  // Create UserFeed instance to get loggedInUser's posts\n  const userFeed = ig.feed.user(loggedInUser.pk);\n  const myPostsFirstPage = await userFeed.items();\n  // All the feeds are auto-paginated, so you just need to call .items() sequentially to get next page\n  const myPostsSecondPage = await userFeed.items();\n  await ig.media.like({\n    // Like our first post from first page or first post from second page randomly\n    mediaId: sample([myPostsFirstPage[0].id, myPostsSecondPage[0].id]),\n    moduleInfo: {\n      module_name: 'profile',\n      user_id: loggedInUser.pk,\n      username: loggedInUser.username,\n    },\n    d: sample([0, 1]),\n  });\n})();\n```\n\n# Basic concepts\n\n**You can find documentation in the [`docs` folder](docs)**.\nConsider starting in [`IgApiClient` (`index` module)](docs/classes/index/IgApiClient.md), the root class.\n\nYou'll often see `ig` in the docs.\nThis just refers to the client, an instance of [`IgApiClient`](docs/classes/index/IgApiClient.md) holding the state for one user.\n\n```typescript\nimport { IgApiClient } from 'instagram-private-api';\n\n// This is the general convention on how to name the client\n//    vv\nconst ig = new IgApiClient();\n\n// login, load a session etc.\n```\n\n## Repositories\n\nRepositories implement low-level operations - every method sends exactly _one_ api-request.\n\n- See the list of **available repositories** [here](docs/modules/repositories.md).\n- See the list of **their keys** in [`IgApiClient` here](docs/classes/index/IgApiClient.md).\n\nYou access repositories on the [client (`IgApiClient`)](docs/classes/index/IgApiClient.md) by their lower-case (_camelCase_) name without the `Repository` suffix.\nFor example, you access the instance of [`AddressBookRepository`](docs/classes/repositories/AddressBookRepository.md) by [`ig.addressBook`](docs/classes/index/IgApiClient.md#addressbook).\n\n## Feeds\n\nFeeds represent paginated endpoints like a user's feed ([`UserFeed`](docs/classes/index/FeedFactory.md#user)).\nThink of feeds like (async-)iterators/streams/observables (in fact feeds are [async iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) and observable (`feed.item$`)).\nEvery feed is accessible via `ig.feed.feedName()` (_camelCase_ name). `ig.feed` is the [`FeedFactory`](docs/classes/index/FeedFactory.md) that creates feeds for you connected to the instance of `ig`.\n\n- See the list of **available feeds** [here](docs/modules/feeds.md).\n- See the list of **their keys** in [`FeedFactory` (`ig.feed`) here](docs/classes/index/FeedFactory.md).\n- See [this example](examples/account-followers.feed.example.ts) and learn how to work with library feeds.\n\nMost of the feeds require initialization parameter(s), like a user-pk (id).\n\n## Services\n\nServices will help you to maintain some actions without calling a couple repository methods or perform complex things like pre and postlogin flow simulations or photo/video publishing.\n\n- See the list of **available repositories** [here](docs/modules/services.md).\n- See the list of **their keys** in [`IgApiClient` here](docs/classes/index/IgApiClient.md).\n\n# Debugging\n\nIn order to get debug infos provided by the library, you can enable debugging.\nThe prefix for this library is `ig`.\nTo get all debug logs (_recommended_) set the namespace to `ig:*`.\n\n#### Node\n\nIn Node you only have to set the environment variable `DEBUG` to the desired namespace.\n[Further information](https://github.com/visionmedia/debug#environment-variables)\n\n# Contribution\n\nIf you need features that is not implemented - feel free to implement and create PRs!\n\nPlus we need some documentation, so if you are good in it - you are welcome.\n\nSetting up your environment is described [here](CONTRIBUTING.md).\n\n# Useful links\n\n[instagram-id-to-url-segment](https://www.npmjs.com/package/instagram-id-to-url-segment) - convert the image url fragment to the media ID\n\n## Special thanks\n\n- [Richard Hutta](https://github.com/huttarichard), original author of this library. Thanks to him for starting it.\n\n## Thanks to contributors\n\n- [Nerixyz](https://github.com/Nerixyz), for writing a huge amount of code for this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdilame%2Finstagram-private-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdilame%2Finstagram-private-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdilame%2Finstagram-private-api/lists"}