dilame / instagram-private-api Goto Github PK
View Code? Open in Web Editor NEWNodeJS Instagram private API SDK. Written in TypeScript.
License: MIT License
NodeJS Instagram private API SDK. Written in TypeScript.
License: MIT License
Hi again!
Does InstagramV1.Feed.TagMedia == GET https://api.instagram.com/v1/tags/{tag-name}/media/recent ??
is it possible to view all users have tagged on photos?
Good day!
I need to get instagram locations by coords from google maps. Is there any way to do it, like in standart api?
https://api.instagram.com/v1/locations/search?lat=48.858844&lng=2.294351&access_token=ACCESS_TOKEN
Location.search(session, {"lat": "48.858844", "lng": "2.294351"}) returns locations with lat: 0, lng: 0
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");
}
@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);
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
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 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
});
});
});
}
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?
I am sorry to open a new issue, however your documentation on this part of the API is limited. Would it be possible to give me an example? Sorry to cause you hassle.
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();
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?
it's mentioned In README but inbox.js doesn't have any method to send direct messages.
Hello! Can I listen my inbox(direct messages) as event for example or should I make request in a loop for checking new messages?
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?
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 ;)
why there is a limit of only 50 photos ?
FeedUserMedia.all()
FeedUserMedia.allSafe()
When I call Client.Session.create()
, the fifth parameter is proxy.
What should be the format proxy?
It can be an example?
if it's possible how can I do that?
And why not, if not?(because instagram does not supports it?)
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
Hi,
Recently instagram introduce stories at feed timeline.
Can you please provide the End Points for the same.
Regards
Alok
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
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
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
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?
AS Topic.
I would like to send message , I don't see any clear instruction on how to send message to a instagram user?
Thanks
is that anyway to gain media views ?
Or how can I learn what methods there are? And how use it?
Thanks a lot.
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)
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.
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()
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?
Can you give me an example. Thanks
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
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.
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)
})
})
}
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 😢
Where can I find sources for instagram-private-api-proxy?
I didn't see the instagram video view support. Will u add the video view feature.
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
get
. e.g locationFeed.get({ ranked: true })
getRankedItems
for this classI 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
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)
Can you help to get endpoint and add this feature - tag users?!
p.s.: article that you mentioned at readme is not online anymore.
I am using a newly created Instagram account I created for testing and I am receiving the following message:
Unhandled rejection CookieNotValidError: Cookie
sessionidyou 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: Cookie
sessionidyou are searching found was either not found or not valid!
Any clues to the cause? Looking forward to working with this library. Thanks!
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
please add hash.commentCount = json.comment_count;
Hey, any plans to support instagram insight/analytics?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.