Giter Site home page Giter Site logo

dilame / instagram-private-api Goto Github PK

View Code? Open in Web Editor NEW
5.7K 167.0 1.1K 7.38 MB

NodeJS Instagram private API SDK. Written in TypeScript.

License: MIT License

TypeScript 100.00%
instagram instagram-api instagram-client instagram-feed instagram-private-api instagram-scraper instagram-sdk

instagram-private-api's People

Contributors

abritov avatar adw0rd avatar aleks63 avatar arvinio avatar dependabot[bot] avatar dilame avatar duclvz avatar duzzifelipe avatar hieven avatar huttarichard avatar ihaiduk avatar ivanmmm avatar justinsoong avatar karlhorky avatar lucasklaassen avatar marek-vybiral avatar mauscoelho avatar nemanjan00 avatar nerixyz avatar omarauf avatar pablomatiasgomez avatar perlbug avatar priesto avatar realinstadude avatar sebyddd avatar sergeymikhryakov avatar sharifpour avatar uigormarshall avatar xsfunc avatar zzarcon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

instagram-private-api's Issues

Callanges Issue

In case of resolving email callange
Like this:

function challengeMe(error) {
    return Client.Web.Challenge.resolve(error)
        .then(function(challenge) {
                   return challenge.email()
        })
        .then(function(challenge) {
            return challenge.code(123456) //The error is here
   })

Here how the error looks like:
Unhandled rejection NotPossibleToResolveChallenge: Not possible to resolve challenge (undefined)!
@huttarichard

How to retrieve Direct Messages and get the message content and title

How would I get the message content and title from sent DMs using this API?
I can send it like this but I have no idea on how to parse the recieved Direct Messages from others?

function sendDM(user, text) {
    // Either gain already gained session
    var session = new Client.Session(device, cookiePath);
    // Or if we cant, create a new session
    var promise = Client.Session.create(device, cookiePath, 'username', 'password');

    promise.then(function(sessionInstance) {
        // Search for the User
        Client.Account.searchForUser(session, user)
         .then(function(accountInstance) {
            var userId = accountInstance.id;

            // Send a DM
            Client.Thread.configureText(session, userId, text)
             .then(function(threads) {
                var thread = threads[0];
                //thread.broadcastText(text);
                console.log(thread.items) // -> see conversation
            });
         });
    });
}

Hashtag

Hi, great job!

I'm trying to get media from a specific hashtag with TagMedia, like this Client.Feed.TagMedia(session, 'example'); but without success, any idea what wrong?

Instagram call checkpoint for this action!

Hi!
Code:

var Client = require('instagram-private-api').Client.V1;
var device = new Client.Device('SAMSUNG_GALAXY_S2', 'xxx');
var cookiePath = __dirname + './cookies/xxx.json';
var promise = Client.Session.create(device, cookiePath, 'xxx', 'yyy');

promise.then(function(sessionInstance){
   console.log(sessionInstance)
});

get me error:
Unhandled rejection CheckpointError: Instagram call checkpoint for this action!

Whats wrong?

Error: read ECONNRESET

Hello!
All was working fine, but 3-4 days ago I started to get this error while trying to make any request from your package in random order.
The same request can work normally or may generate this error at different times.
After 3 days of debugging I still have no idea what is the reason and how to resolve this.
So I want to ask if only I get this trouble or there is a common problem and is there any solution for that?
I will be glad to any advice.

(STDERR) Unhandled rejection RequestError: Error: read ECONNRESET
(STDERR)     (No stack trace)
(STDERR) From previous event:
(STDERR)     at Request.send (.../package/node_modules/instagram-private-api/client/v1/request.js:371:15)
(STDERR)     at AccountFollowersFeed.get .../package/node_modules/instagram-private-api/client/v1/feeds/account-followers.js:35:10)

user tagging

Can you help to get endpoint and add this feature - tag users?!

p.s.: article that you mentioned at readme is not online anymore.

Issue When posting Relationship and like

When I'm posting a relationship its working fine, but with liking and commenting nothing happens

Client.Session.create(device, storage, username, password)
    .then(function(session) {
        // post relationship is working fine
        Client.Relationship.create(session, '315822896');
        // post like is not working
        Client.Like.create(session, '1171090556536571800_315822896');

  })

I'm new In web programming so maybe I'm going something wrong ;)
could you provide a short example please ?
@huttarichard

How to handle error ?

Lets say I am trying to comment on a media like this way -->

Client.Comment.create(session,'1277948371156593808','test').then(function(data){
    if(data.params.created){
        console.log('done');
    }else{
        console.log('not');
    }
});

If media-id not found then application raise an error. How can I catch that error?

How to use MemoryCookieStore?

@huttarichard please, could you help me? I store my cookies in database as a string. What shoud i use to create Session instance correctly?
It seems like i need to use MemoryCookieStore, but it not works for me. this is how i do

var storage = new Client.CookieStorage(new require('tough-cookie/lib/memstore.js').MemoryCookieStore);

Account followers

When I try to get account followers, I get 200 accounts and no more. More than, after this I got cursor, which looks like this:

AQCHlqay8AnNx5GrUjI1E3SQT6vGMrsjPYHw_S7k-ozxtIBIXOUbm3Zs4x6hU0ju3ANeudiaO0vR7yT_zXuwX07KDsTCw-28a7X9IW9GOMI_MEaUSM6ni7VTt5MAiZDl60o

Code:

      Search () {
        Client.Account.searchForUser(this.session, this.search).then((user) => {
          let feed = new Client.Feed.AccountFollowers(this.session, user.id)
          new Promise((resolve, reject) => {
            resolve(feed.get())
          })
          .then((results) => {
            console.log(feed.cursor)
            Vue.set(this, 'subscribers', results)
          })
        })
      }

Unhandled rejection CookieNotValidError

I am using a newly created Instagram account I created for testing and I am receiving the following message:
Unhandled rejection CookieNotValidError: Cookiesessionidyou are searching found was either not found or not valid!

However, I was able to gain a session with an older Instagram account over two years old. When I remove theusername.json file from the cookies directory and try to gain a new session with the older account, I receive the same message Unhandled rejection CookieNotValidError: Cookiesessionidyou are searching found was either not found or not valid!

Any clues to the cause? Looking forward to working with this library. Thanks!

How to use setPhoneCallback in phone account creator?

The fact is that I can't know verification code at the time I write code.

creator .setPhone('123') .setUsername('aa') .setPassword('123') .setName('Me') .setPhoneCallback(function( return Promise.resolve("I Don't Know Code Yet") }) .register()

Cyrillic in hashtag

Hi!

I use
var feed = new InstagramV1.Feed.TagMedia(sessionInstance, 'yourhashtag');
and its work fine with english hashtag (f.e. #forumtavrida), but if i put cirillic (f.e #форумтаврида) its return nothing (but Andriod client find photos with it).

Any ideas?

setCookie from string

Wonderful library! But there is one defect, i think. Сurrently i store my cookies in database, because having a lot of files is not usable. Could you, please, provide the possibility to set cookies from string?

Checkpoint - Not found

Hey,
When I trying to use checkpoint function, I have error:

Unhandled rejection NotFoundError: Page wasn't found!

When I check body of result I can read there is not logged in.

I also add session param to WebRequest, becouse is missing, but It didn't resolve my error.

Inbox feed constructor error

I would like to fetch my account inbox but when I try to, got some errors . Here is my code

var feed = new Client.Feed.InboxFeed(session);
feed.get()
.then(function(data){
console.log(data, "you just got first page");
return feed.get()
})
.then(function(data) {
console.log(data, "you just got second page")
})

at the end this code raise an error like this

var feed = new Client.Feed.InboxFeed(session);
^

TypeError: Client.Feed.InboxFeed is not a constructor

Hope to know if I can create session by using access_token

Hi Huttarichard,

Thank you for your nice work.

I have lots of interest about your project and hope to know if I can get or create new session by using access_token, not using username and password.

I checked sessions.js and know that you are using username/password for instagram login.

But because I already use oauth stream to login instagram, what I have now is just access_token.

So, I hope to know if I can create session by using access_token when I already logged in.

Regards Sincerely

How the cookie file should look like?

Hey, I'm new in node, actually today I've seen it for the first time ;)
I just can't understand how the /cookies/someuser.json file should look like ? and should a create it by my own or not ?

Thank you so mush for a help ;)

Try to register account, getting some errors

Unhandled rejection ActionSpamError: This action was disabled due to block from instagram!
I'm getting this error, is it mean that this functions does not work anymore?
Or what?

How do I loop through thread.items?

Hey its me again, I sorted out the client code so it works but now I need help looping through and getting the messages from thread.items (I have subscribed to the thread using ClientProxy.Thread.subscribeAll)

How to upload photo ?

var path_photo = path.join(__dirname, '/test.jpg') ;

Client.Upload.photo(session, path_photo).then(function(accountInstance) {
console.log(accountInstance);
});

it works. but my photos are not uploading. thanks

issue/exceptions thrown when creating accounts

I was successfully able to create an account, however I always get the following exceptions although the account was created:

Unhandled rejection Error: Argument session is not instace of Session

var device = new Client.Device(username);
var storage = new Client.CookieFileStorage(__dirname + '/cookies/' + username + '.json');
var session = new Client.Session(device, storage);
//session.proxyUrl = 'http://aditya:[email protected]';

new Client.AccountEmailCreator(session)
    .setEmail( username + '@gmail.com')
    .setUsername(username)
    .setPassword('kerencuyy')
    .setName('Pusing Mikirin Insta')
    .register()
    .then(function(session) {

    });

why is this? seemed that the exception is on thrown on this line in resource.js:

 var Session = require("./session");
    if (!(session instanceof Session))
        throw new Error("Argument `session` is not instace of Session");
    this._session = session;

can't seem to figure out why

How do I keep a running feed of my Timeline with your API

I tried the following:

var Client = require('instagram-private-api').V1;
var _ = require('underscore');
var Promise = require('bluebird');
var device = new Client.Device('username');

var storage = new Client.CookieFileStorage(__dirname + '/cookies/username.json');

var session = Client.Session.create(device, storage, 'username', 'password');
var feed = new Client.Feed.Timeline(session);
var accountId = '123456789'

console.log(feed);

Promise.map(_.range(0,100), function() {
    return feed.get();
}).then(function(results) {
    console.log(results)
});

It doesn't seem to work.

It throws an error Unhandled rejection TypeError: Object [object Promise] has no method 'getAccountId' for the line feed.get();

Uploading account image to new profile

Once I create an account, I am trying to upload an image. I am not getting any errors nor is the image uploading. I noticed in your example you use Account.setProfilePicture however I am using Client.set.. Im not sure if this is the problem but here is my code

            new Client.AccountEmailCreator(session)
                .setEmail(email)
                .setUsername(username)
                .setPassword(password)
                .setName(name)
                .register()
                .spread(function(account, discover) {
                    // account instanceof Client.Account
                    console.log("Created Account", account)
                    console.log("Discovery Feed", discover);


                })

                console.log("time to set profile")
                //do account image set    nothing here seems to work or thrw errors
                Client.setProfilePicture = function (session, streamOrPath) {
                    var stream = Helpers.pathToStream(streamOrPath);
                    var request = new Request(session)
                    console.log("Okay")
                    return request.setMethod('POST')
                        .setResource('changeProfilePicture')                    
                        .generateUUID()
                        .signPayload()
                        .transform(function(opts){
                            opts.formData.profile_pic = {
                                value: stream,
                                options: {
                                    filename: 'profile_pic',
                                    contentType: 'image/jpeg'
                                }
                            }
                            return opts;
                            console.log("File ready");
                        })
                        .send()
                        console.log("Sent")
                        .then(function(json) {
                            return new Account(session, json.user)    
                            console.log("returned");
                        })
                }



        } else {
            console.log("Was not created");
        }

Can I use ipv6 proxy?

if it's possible how can I do that?
And why not, if not?(because instagram does not supports it?)

Ca I listen my inbox?

Hello! Can I listen my inbox(direct messages) as event for example or should I make request in a loop for checking new messages?

Will be valid to use?

Hi,

I want to use this into my project, but is it valid to use it ?

and once Instagram update their API, how is it & still able to use ?

Thanks

Increase Video View

hi huttarichard, and hope you are well

I have one question,Is there a way to increase video view? I think that have private endpoint, that add view count, whit use users data such as cookie, IP ,etc.

Please help me

Best Regard.

get ranked items in location media

hey, I would like to grab ranked items in location media. However, it is not possible to do that because the code just return data.items

check the code here https://github.com/huttarichard/instagram-private-api/blob/master/client/v1/feeds/location-media.js#L30

Currently, I have 2 ideas below

  • pass a boolean into get. e.g locationFeed.get({ ranked: true })
  • another method called getRankedItems for this class

I would like to make another PR later.
Thus. which way is more appropriate to you?
Or do you have other brilliant suggestions that I can help?

Thanks

How use proxy?

When I call Client.Session.create(), the fifth parameter is proxy.
What should be the format proxy?
It can be an example?

Upload photo

is posible upload photo? i try this:

var promise = Client.Session.create(device, cookiePath, 'username', 'pass')

promise.then(function(sessionInstance) {
  Client.Upload.photo(sessionInstance, 'test.jpg').then(function (out) {
    console.log(out)
  })
})

return Upload object, but no upload 😢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.