Simple, easy implementation of the Instagram private web API.
npm install node-insta-web-api
//get profile data
const Insta = require('node-insta-web-api')
const InstaClient = new Insta();
(async () => {
await InstaClient.login('username','password');
const profileData = await InstaClient.getProfileData();
console.log(profileData)
})()
//get image by username
const Insta = require('node-insta-web-api')
const InstaClient = new Insta();
(async () => {
await Insta.getCookie()
const photos = await Insta.getImageByUser('username');
console.log(photos)
})()
//update bio using existing cookies
const Insta = require('node-insta-web-api')
const InstaClient = new Insta();
(async () => {
await InstaClient.useExistingCookie()
const payload = {
biography: 'test update bio 1'
}
const result = await InstaClient.updateProfile(payload)
console.log(result)
})()
- Instagram
- .getCookie()
- ._getMediaId(url)
- .useExistingCookie()
- .login(username, password)
- .getProfileData()
- .changeProfileImage(image)
- .getImageByUser(username)
- .getVideoByShortCode(shortCode)
- .getLoginActivity()
- .getRecentNotification()
- .getDirectMessage()
- .getProfileByUsername(username)
- .followByUsername(username)
- .unfollowByUsername(username)
- .getStoriesByUsername(username)
- .likeMediaByShortCode(shortCode)
- .unlikeMediaByShortCode(shortCode)
- .deleteMediaByShortCode(shortCode)
- .saveImageByShortCode(shortCode)
- .unsaveImageByShortCode(shortCode)
- .commentToMediaByShortCode({shortCode, commentText})
- .replyCommentByShortCode({shortCode, commentText, commentId})
- .getEmbedMediaByShortCode(shortCode)
- .findPeopleByUsername(username)
await client.getCookie()
getting guest cookie
await client._getMediaId('https://www.instagram.com/p/CDFIAxxxxx/')
getting media id by url
url
: AString
await client.useExistingCookie()
u can use existing cookies, if you don't want to log in repeatedly
await client.login('username', 'password')
Login.
username
: AString
password
: AString
//login required
await InstaClient.login('username','password');
const profileData = await InstaClient.getProfileData();
console.log(profileData)
Getting profile data.
//login required
//using a url is under development
//by url
await InstaClient.login('username','password');
await InstaClient.changeProfileImage('url')
//by path
await InstaClient.login('username','password');
const photo = path.join(__dirname, 'blackhat.png');
await InstaClient.changeProfileImage(photo)
Change Profile Image.
image
: AString
url / image path
const payload = {
biography: 'test update bio 1'
}
const a = await InstaClient.updateProfile(payload)
console.log(a)
update profile. for now you can only update your bio.
params
biography
: AString
await client.getImageByUser('username')
Gets user photos.
username
: AString
const data = await InstaClient.getVideoByShortCode('CDDs8unBjXX');
fs.writeFileSync('./test.mp4', data.base64, 'base64')
console.log(data)
Get video base64 and buffer by short code.
shortCode
: AString
//login required
await InstaClient.useExistingCookie()
const data = await InstaClient.getLoginActivity();
console.log(data)
get login activity.
//login required
await InstaClient.useExistingCookie()
const data = await InstaClient.getRecentNotification();
console.log(data)
get recent notification.
//login required
await InstaClient.useExistingCookie()
const data = await InstaClient.getDirectMessage();
console.log(data)
get direct message.
await InstaClient.getCookie()
const data = await InstaClient.getProfileByUsername('username');
console.log(data)
get profile user.
username
: AString
//login required
await InstaClient.useExistingCookie()
const data = await InstaClient.followByUsername('username');
console.log(data)
follow user by username.
username
: AString
//login required
await InstaClient.useExistingCookie()
const data = await InstaClient.unfollowByUsername('username');
console.log(data)
unfollow user by username.
username
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.getStoriesByUsername('username');
console.log(data)
get stories by username.
username
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.likeMediaByShortCode('CDFIAQtHUxxxx');
console.log(data)
like media by shortcode
shortCode
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.unlikeMediaByShortCode('CDFIAQtHUxxxx');
console.log(data)
unlike media by shortcode
shortCode
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.deleteMediaByShortCode('CDFIAQtHUxxxx');
console.log(data)
delete media by shortcode
shortCode
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.saveImageByShortCode('CDFIAQtHUxxxx');
console.log(data)
save media by shortcode
shortCode
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.unsaveImageByShortCode('CDFIAQtHUxxxx');
console.log(data)
save media by shortcode
shortCode
: AString
await InstaClient.useExistingCookie()
const payload = {
shortCode:'CDFIAQxxxx',
commentText: 'Your Text Comment'
}
const data = await InstaClient.commentToMediaByShortCode(payload);
console.log(data)
add comment to a media by shortcode
params
shortCode
: AString
commentText
: AString
await InstaClient.useExistingCookie()
const payload = {
shortCode:'CDFIAQtxxxx',
commentText: '%40username reply comment',
commentId: '17870873200867xxx'
}
const data = await InstaClient.replyCommentByShortCode(payload);
console.log(data)
reply comment in media by shortcode
params
shortCode
: AString
commentText
: AString
commentId
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.getEmbedMediaByShortCode('CDFIAQtHUiw');
console.log(data)
get embed media by shortCode
shortCode
: AString
await InstaClient.useExistingCookie()
const data = await InstaClient.findPeopleByUsername('menjadi');
console.log(data)
find people bu username
username
: AString
MIT © Archv Id