Skip to content

Simple, easy implementation of the Instagram private web API.

Notifications You must be signed in to change notification settings

ihamdan991/node-insta-web-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Instagram Private Web API client 📷🔥 ❤️

Simple, easy implementation of the Instagram private web API.

Install

npm install node-insta-web-api

Usage

//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)
})()

API Reference

getCookie()

await client.getCookie()

getting guest cookie

_getMediaId(url)

await client._getMediaId('https://www.instagram.com/p/CDFIAxxxxx/')

getting media id by url

  • url: A String

useExistingCookie()

await client.useExistingCookie()

u can use existing cookies, if you don't want to log in repeatedly

login(username, password)

await client.login('username', 'password')

Login.

  • username: A String
  • password: A String

getProfileData()

  //login required
  await InstaClient.login('username','password');
  const profileData = await InstaClient.getProfileData();
  console.log(profileData)

Getting profile data.

changeProfileImage(image)

  //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 : A String url / image path

updateProfile(params)

  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: A String

getImageByUser(params)

await client.getImageByUser('username')

Gets user photos.

  • username: A String

getVideoByShortCode(shortCode)

  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: A String

getLoginActivity()

  //login required
  await InstaClient.useExistingCookie()
  const data = await InstaClient.getLoginActivity();
  console.log(data)

get login activity.

getRecentNotification()

  //login required
  await InstaClient.useExistingCookie()
  const data = await InstaClient.getRecentNotification();
  console.log(data)

get recent notification.

getDirectMessage()

  //login required
  await InstaClient.useExistingCookie()
  const data = await InstaClient.getDirectMessage();
  console.log(data)

get direct message.

getProfileByUsername(username)

  await InstaClient.getCookie()
  const data = await InstaClient.getProfileByUsername('username');
  console.log(data)

get profile user.

  • username: A String

followByUsername(username)

  //login required
  await InstaClient.useExistingCookie()
  const data = await InstaClient.followByUsername('username');
  console.log(data)

follow user by username.

  • username: A String

unfollowByUsername(username)

  //login required
  await InstaClient.useExistingCookie()
  const data = await InstaClient.unfollowByUsername('username');
  console.log(data)

unfollow user by username.

  • username: A String

getStoriesByUsername(username)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.getStoriesByUsername('username');
  console.log(data)

get stories by username.

  • username: A String

likeMediaByShortCode(shortCode)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.likeMediaByShortCode('CDFIAQtHUxxxx');
  console.log(data)

like media by shortcode

  • shortCode: A String

unlikeMediaByShortCode(shortCode)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.unlikeMediaByShortCode('CDFIAQtHUxxxx');
  console.log(data)

unlike media by shortcode

  • shortCode: A String

deleteMediaByShortCode(shortCode)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.deleteMediaByShortCode('CDFIAQtHUxxxx');
  console.log(data)

delete media by shortcode

  • shortCode: A String

saveImageByShortCode(shortCode)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.saveImageByShortCode('CDFIAQtHUxxxx');
  console.log(data)

save media by shortcode

  • shortCode: A String

unsaveImageByShortCode(shortCode)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.unsaveImageByShortCode('CDFIAQtHUxxxx');
  console.log(data)

save media by shortcode

  • shortCode: A String

commentToMediaByShortCode(params)

  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: A String
    • commentText: A String

replyCommentByShortCode(params)

  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: A String
    • commentText: A String
    • commentId: A String

getEmbedMediaByShortCode(shortCode)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.getEmbedMediaByShortCode('CDFIAQtHUiw');
  console.log(data)

get embed media by shortCode

  • shortCode: A String

findPeopleByUsername(username)

  await InstaClient.useExistingCookie()
  const data = await InstaClient.findPeopleByUsername('menjadi');
  console.log(data)

find people bu username

  • username: A String

License

MIT © Archv Id

About

Simple, easy implementation of the Instagram private web API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%