Private Api Instagram
![](/file/9d11000d16f29988389bc.gif)
🔞 ALL INFORMATION CLICK HERE 👈🏻👈🏻👈🏻
Private Api Instagram
We want your feedback on Python Packaging.
Take our survey today!
Help
Sponsors
Log in
Register
Menu
Help
Sponsors
Log in
Register
Search PyPI
Search
Navigation
Project description
Release history
Download files
Project links
Homepage
Classifiers
Development Status
4 - Beta
Intended Audience
Developers
License
OSI Approved :: MIT License
Programming Language
Python :: 2.7
Python :: 3.5
Topic
Software Development :: Libraries :: Python Modules
Project links
Homepage
Classifiers
Development Status
4 - Beta
Intended Audience
Developers
License
OSI Approved :: MIT License
Programming Language
Python :: 2.7
Python :: 3.5
Topic
Software Development :: Libraries :: Python Modules
Help
Installing packages
Uploading packages
User guide
FAQs
About PyPI
PyPI on Twitter
Infrastructure dashboard
Package index name retention
Our sponsors
Contributing to PyPI
Bugs and feedback
Contribute on GitHub
Translate PyPI
Development credits
Using PyPI
Code of conduct
Report security issue
Privacy policy
Terms of use
English
español
français
日本語
português (Brasil)
українська
Ελληνικά
Deutsch
中文 (简体)
中文 (繁體)
русский
עברית
esperanto
pip install instagram-private-api
Copy PIP instructions
A client interface for the private Instagram API.
View statistics for this project via Libraries.io , or by using our public dataset on Google BigQuery
Tags
instagram,
private,
api
A Python wrapper for the Instagram private API with no 3rd party dependencies. Supports both the app and web APIs.
I wrote this to access Instagram's API when they clamped down on developer access. Because this is meant to achieve parity with the official public API , methods not available in the public API will generally have lower priority.
Problems? Please check the docs before submitting an issue.
An extension module is available to help with common tasks like pagination, posting photos or videos.
pip install git+https://git@github.com/ping/instagram_private_api.git@1.6.0
pip install git+https://git@github.com/ping/instagram_private_api.git@1.6.0 --upgrade
pip install git+https://git@github.com/ping/instagram_private_api.git --upgrade --force-reinstall
The app API client emulates the official app and has a larger set of functions. The web API client has a smaller set but can be used without logging in.
Your choice will depend on your use case.
The examples/ and tests/ are a good source of detailed sample code on how to use the clients, including a simple way to save the auth cookie for reuse.
You are advised to persist/cache the auth cookie details to avoid logging in every time you make an api call. Excessive logins is a surefire way to get your account flagged for removal. It's also advisable to cache the client details such as user agent, etc together with the auth details.
The saved auth cookie can be reused for up to 90 days .
Want to keep this project going? Please donate generously https://www.buymeacoffee.com/ping
Make sure to review the contributing documentation before submitting an issue report or pull request.
Disclaimer: This is not affliated, endorsed or certified by Instagram. This is an independent and unofficial API. Strictly not for spam . Use at your own risk.
View statistics for this project via Libraries.io , or by using our public dataset on Google BigQuery
Tags
instagram,
private,
api
Download the file for your platform. If you're not sure which to choose, learn more about installing packages .
Uploaded May 6, 2019
source
Uploaded May 6, 2019
py3
Developed and maintained by the Python community, for the Python community.
Donate today!
dfe0c2cb5aa881b98b2e428c3b02fa664a52af3f2d2354c19c4a8967cedf5d8e
ca81282d8f016de44260296e1fd50ec6aaadb6c542d3bab982eb14783b54cf8b
5f9403fbd359764b2d070fa8ac22bc4546ec5a53c45676bcddafa66dc74d2f07
554c6a37c5f1f2777191104970452ff495d2579ffcdfa73d2cb617e865f9c554
import { IgApiClient } from 'instagram-private-api' ;
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 ] ) ,
} ) ;
} ) ( ) ;
import { IgApiClient } from 'instagram-private-api' ;
// This is the general convention on how to name the client
// vv
const ig = new IgApiClient ( ) ;
// login, load a session etc.
Me and Nerix are ready to announce the next 2.x.x version of this library.
It has extended feature list.
It's a big release.
We have significantly expanded the functionality and capabilities.
The library turned into a monorepository and now it's a set of libraries, connected in an ecosystem.
It consists of
We've done some work on design decisions.
We simplified the state management process.
Now you can easily make a snapshot of account state, save it in a persistent storage and then restore a 1-to-1 copy with just 1 function call.
With new realtime features you can listen for new direct messages, notifications and any other events.
The new version is hosted in private repository. Access is paid.
Members get basic support for installation, configuration, and usage.
We also will try to react on your feature requests.
You can contact me in telegram or email for details.
This package uses url-regex-safe ( GitHub ) to check for links when sending direct messages.
By default, the safe regex engine re2 is not installed.
⚠ It's highly recommended for you to install re2 by running npm install re2 , else you will be vulnerable to CVE-2020-7661 .
If you find this library useful for you, you can support it by donating any amount
BTC: 1Dqnz9QuswAvD3t7Jsw7LhwprR6HAWprW6
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')
You can find documentation in the docs folder .
Consider starting in IgApiClient ( index module) , the root class.
You'll often see ig in the docs.
This just refers to the client, an instance of IgApiClient holding the state for one user.
Repositories implement low-level operations - every method sends exactly one api-request.
You access repositories on the client ( IgApiClient ) by their lower-case ( camelCase ) name without the Repository suffix.
For example, you access the instance of AddressBookRepository by ig.addressBook .
Feeds represent paginated endpoints like a user's feed ( UserFeed ).
Think of feeds like (async-)iterators/streams/observables (in fact feeds are async iterable and observable ( feed.item$ )).
Every feed is accessible via ig.feed.feedName() ( camelCase name). ig.feed is the FeedFactory that creates feeds for you connected to the instance of ig .
Most of the feeds require initialization parameter(s), like a user-pk (id).
Services 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.
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
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
Docs »
Developer Interface
Edit on GitHub
{
"status" : "ok" ,
"incoming_request" : false ,
"is_blocking_reel" : true ,
"followed_by" : false ,
"is_muting_reel" : false ,
"outgoing_request" : false ,
"following" : false ,
"blocking" : true ,
"is_private" : false
}
{
"status" : "ok" ,
"broadcast_status" : "active" ,
"media_id" : "12345678934374208_123456789" ,
"cover_frame_url" : "https://scontent-hkg3-1.cdninstagram.com/something.jpg" ,
"broadcast_owner" : {
"username" : "abc" ,
"friendship_status" : {
"incoming_request" : false ,
"followed_by" : false ,
"outgoing_request" : false ,
"following" : false ,
"blocking" : false ,
"is_private" : false
},
"profile_pic_url" : "http://scontent-hkg3-1.cdninstagram.com/somethingelse.jpg" ,
"profile_pic_id" : "1234567850644676241_123456789" ,
"full_name" : "ABC" ,
"pk" : 123456789 ,
"is_verified" : true ,
"is_private" : false
},
"dash_abr_playback_url" : null ,
"broadcast_message" : "" ,
"published_time" : 1485312576 ,
"dash_playback_url" : "https://scontent-hkg3-1.cdninstagram.com/hvideo-ash1/v/dash-hd/spmething.mpd" ,
"rtmp_playback_url" : "rtmp://svelivestream007.16.ash1.facebook.com:16000/live-hd/something" ,
"id" : 178591123456789 ,
"viewer_count" : 9000.0
}
{
"status" : "ok" ,
"available" : false ,
"username" : "xxx" ,
"error_type" : "username_is_taken" ,
"error" : "The username xxx is not available."
}
{
"status" : "ok" ,
"collection_id" : "1700000000123" ,
"cover_media" : {
"media_type" : 1 ,
"original_width" : 1080 ,
"original_height" : 1080 ,
"id" : 1492726080000000 ,
"image_versions2" : {
"candidates" : [
{
"url" : "http://scontent-xx4-1.cdninstagram.com/...123.jpg" ,
"width" : 1080 ,
"height" : 1080
},
...
]
}
},
"collection_name" : "A Collection"
}
{ "status" : "ok" , "did_delete" : true }
usertags = [
{ "user_id" : 4292127751 , "position" : [ 0.625347 , 0.4384531 ]}
]
{
"status" : "ok" ,
"incoming_request" : false ,
"is_blocking_reel" : false ,
"followed_by" : false ,
"is_muting_reel" : false ,
"outgoing_request" : false ,
"following" : false ,
"blocking" : true ,
"is_private" : false
}
{
"status" : "ok" ,
"friendship_status" : {
"incoming_request" : false ,
"followed_by" : false ,
"outgoing_request" : false ,
"following" : true ,
"blocking" : false ,
"is_private" : false
}
}
{
"status" : "ok" ,
"incoming_request" : false ,
"is_blocking_reel" : false ,
"followed_by" : false ,
"is_muting_reel" : false ,
"outgoing_request" : false ,
"following" : false ,
"blocking" : false ,
"is_private" : false
}
{
"status" : "ok" ,
"incoming_request" : false ,
"is_blocking_reel" : false ,
"followed_by" : false ,
"is_muting_reel" : false ,
"outgoing_request" : false ,
"following" : false ,
"blocking" : false ,
"is_private" : false
}
{
"status" : "ok" ,
"friendship_statuses" : {
"123456789" : {
"following" : false ,
"incoming_request" : true ,
"outgoing_request" : false ,
"is_private" : false
}
}
}
{
"status" : "ok" ,
"incoming_request" : false ,
"is_blocking_reel" : false ,
"followed_by" : false ,
"is_muting_reel" : false ,
"outgoing_request" : false ,
"following" : false ,
"blocking" : false ,
"is_private" : false
}
{
"status" : "ok" ,
"location" : {
"external_source" : "facebook_places" ,
"city" : "" ,
"name" : "Berlin Brandenburger Tor" ,
"facebook_places_id" : 114849465334163 ,
"address" : "Pariser Platz" ,
"lat" : 52.51588 ,
"pk" : 229573811 ,
"lng" : 13.37892
}
}
{
"1309763051087626108_124317_124317" : [ "1470355944_1470372029" ],
"1309764045355643149_124317_124317" : [ "1470356063_1470372039" ],
"1309818450243415912_124317_124317" : [ "1470362548_1470372060" ],
"1309764653429046112_124317_124317" : [ "1470356135_1470372049" ],
"1309209597843679372_124317_124317" : [ "1470289967_1470372013" ]
}
where
1309763051087626108 _124317 = < media_id > ,
124317 = < media . owner_id >
1470355944 _1470372029 is < media_created_time > _ < view_time >
medias = [
{ "type" : "image" , "size" : ( 720 , 720 ), "data" : "..." },
{
"type" : "image" , "size" : ( 720 , 720 ),
"usertags" : [{ "user_id" : 4292127751 , "position" : [ 0.625347 , 0.4384531 ]}],
"data" : "..."
},
{ "type" : "video" , "size" : ( 720 , 720 ), "duration" : 12.4 , "thumbnail" : "..." , "data" : "..." }
]
{
"comment" : {
"status" : "Active" ,
"media_id" : 123456789 ,
"text" : ":)" ,
"created_at" : 1479453671.0 ,
"user" : {
Czech Outdoor Sex
Cassiopeia Nudist Beach
Gangbang With Pee Piss