{"_id":"@anakis/instagram-web-api","_rev":"1-be870ee5b2ee36795a109c7f3a174e68","name":"@anakis/instagram-web-api","dist-tags":{"latest":"2.1.1"},"versions":{"2.1.1":{"name":"@anakis/instagram-web-api","version":"2.1.1","description":"Instagram Private Web API client written in JS","license":"MIT","main":"lib/index.js","repository":{"type":"git","url":"git+https://github.com/anakis/instagram-web-api.git"},"author":{"name":"Jesus Lobos","email":"jlobitu@gmail.com","url":"https://jlobos.com"},"contributors":[{"name":"Anakis","email":"thiag.g3@gmail.com"}],"scripts":{"lint":"xo","test":"xo && ava"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"prettier":{"semi":false,"singleQuote":true},"keywords":["❤️","🤳","📷","instagram","private","api","web","upload","like","comment","save","follow","search","ig","photo","selfie"],"xo":{"extends":"prettier","rules":{"camelcase":0,"no-await-in-loop":0,"no-unmodified-loop-condition":0}},"lint-staged":{"*.js":["xo --quiet","prettier --single-quote --no-semi --write","git add"]},"dependencies":{"is-url":"^1.2.4","request":"^2.88.0","request-promise-native":"^1.0.8","tough-cookie":"^3.0.1","useragent-from-seed":"^1.0.1"},"devDependencies":{"ava":"^2.4.0","eslint-config-prettier":"^2.10.0","husky":"^3.0.9","lint-staged":"^9.4.3","prettier":"^1.19.1","xo":"^0.20.3"},"gitHead":"6d92a48e743f61f1c9651a8bfffeac07be207756","bugs":{"url":"https://github.com/anakis/instagram-web-api/issues"},"homepage":"https://github.com/anakis/instagram-web-api#readme","_id":"@anakis/instagram-web-api@2.1.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"anakis","email":"thiag.g3@gmail.com"},"dist":{"integrity":"sha512-O6TUQClaLXBIE76s90VR4TVY1CDhuupRDWvnDR5bmolLE1L8XEQqo9gw2nh2877ENxKY39j5TU1Cx/Ui3pGNbQ==","shasum":"0797f608ddbb9ac7567fe6f39c2191816a97ac0b","tarball":"https://registry.npmjs.org/@anakis/instagram-web-api/-/instagram-web-api-2.1.1.tgz","fileCount":4,"unpackedSize":29644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJewWeACRA9TVsSAnZWagAA0AUP/i7AubMNdLIrTQClI3FR\ndiKTSlLQnhonl81p+f8ZhQrQiUpHjfF8Wb7pcVFcWgNOPkqxQ7RjCsthkcFV\n8at5wlB4pYur2da8geXxL82RihXJmpKYC0Q+Q/8YgBmtGVr1VZXgLvVf4/2W\nkHJHV09wKxGWkMsXYf8x98rLZZ2IZvMV9AtAMVn+bQmny1OYcptXMnvrl/yy\nEllsl3iJv965geaQBxsFWT8xsbf2lihLLkKM1VwQVgNShrt3DkOwu6v46nGq\nVNPz0L7MkSPvddzgJ5uV5KKroQ84ww5nSw+fBy5DDfDXYn08IAYlP/UMzGb2\nLFMf7qZAaaqkxTF+hAxmqcmEAdxmg1EkQlglOvWp54WI4R5S/LrFeoeRIzwd\ncgmSyB9pQb9QhpUnbshSB9cJ9evEdpltL10V/JS1bnROZvLUi9B2CibnkLjN\n6Ffz0ykFi7joeHje8OkmF0cKi2tSjsO/JRtdbt12ggW3O9HzydY1tCOtx6UZ\noyhjodAfVGzh52a4BIFUuwNn2ZZBzTqOR55oQX3nnoA6uCkXZ8OUjwtUmzk5\nNL+BQ1e8eaZXp9mg2cjvOUNiP1cXj+FDbj4v4GSzWD2lypflKa3dRrCcfHY8\nTVfqG4ozFoUZMs4/iDTOZ0F23Dw/tVJjBxSr7NrILbzv5ZFSJ0FSJqgDPIVt\n3DDe\r\n=Jfhs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCoZQJGYfU5fGEZ0nhz06KUGC4bnpJR3HYk+kbuTI5/awIgfhRGDz14zt4sJxqNaBxU5FB2v3gIso/CGJCwATl3Lmg="}]},"maintainers":[{"name":"anakis","email":"thiag.g3@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/instagram-web-api_2.1.1_1589733247763_0.49520761404122515"},"_hasShrinkwrap":false}},"time":{"created":"2020-05-17T16:34:07.717Z","2.1.1":"2020-05-17T16:34:07.852Z","modified":"2022-04-04T13:53:45.693Z"},"maintainers":[{"name":"anakis","email":"thiag.g3@gmail.com"}],"description":"Instagram Private Web API client written in JS","homepage":"https://github.com/anakis/instagram-web-api#readme","keywords":["❤️","🤳","📷","instagram","private","api","web","upload","like","comment","save","follow","search","ig","photo","selfie"],"repository":{"type":"git","url":"git+https://github.com/anakis/instagram-web-api.git"},"contributors":[{"name":"Anakis","email":"thiag.g3@gmail.com"}],"author":{"name":"Jesus Lobos","email":"jlobitu@gmail.com","url":"https://jlobos.com"},"bugs":{"url":"https://github.com/anakis/instagram-web-api/issues"},"license":"MIT","readme":"<h1 align=\"center\">\n  <img width=\"72px\" src=\"https://firebasestorage.googleapis.com/v0/b/random-storage-332ce.appspot.com/o/instagram.svg?alt=media&token=5fe11096-daee-43c1-8d5f-8a77c9f46485\">\n</h1>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/instagram-web-api\"><img alt=\"NPM version\" src=\"https://badge.fury.io/js/instagram-web-api.svg\"></a>\n  <a href=\"https://circleci.com/gh/jlobos/instagram-web-api\"><img alt=\"Build Status\" src=\"https://circleci.com/gh/jlobos/instagram-web-api.svg?style=shield\"></a>\n  <a href=\"https://github.com/sindresorhus/xo\"><img alt=\"XO code style\" src=\"https://img.shields.io/badge/code_style-XO-5ed9c7.svg\"></a>\n  \n</p>\n\n### A Instagram Private Web API client 🤳✨❤️\n\nSimple, easy and very complete implementation of the Instagram private web API.\n\n- Support for all the main functions of [Instagram Web](https://www.instagram.com/)\n- Well tested, CI\n- All test runs daily\n\n## Install\n\n```bash\nnpm install instagram-web-api\n```\n\n## Usage\n\nIntance `Instagram` and call `login` method; this stores the credentials in memory.\n\n```js\nconst Instagram = require('instagram-web-api')\nconst { username, password } = process.env\n\nconst client = new Instagram({ username, password })\n\nclient\n  .login()\n  .then(() => {\n    client\n      .getProfile()\n      .then(console.log)\n  })\n```\n\nUsing `async`/`await` in Node >= 8\n\n```js\nconst Instagram = require('instagram-web-api')\nconst { username, password } = process.env\n\nconst client = new Instagram({ username, password })\n\n;(async () => {\n  await client.login()\n  const profile = await client.getProfile()\n\n  console.log(profile)\n})()\n```\n\nSave cookies to disk by using a `though-cookie` store.\n\n```js\n// Packages\nconst Instagram = require('instagram-web-api')\nconst FileCookieStore = require('tough-cookie-filestore2')\n\nconst { username, password } = process.env // Only required when no cookies are stored yet\n\nconst cookieStore = new FileCookieStore('./cookies.json')\nconst client = new Instagram({ username, password, cookieStore })\n\n;(async () => {\n  // URL or path of photo\n  const photo =\n    'https://scontent-scl1-1.cdninstagram.com/t51.2885-15/e35/22430378_307692683052790_5667315385519570944_n.jpg'\n\n  await client.login()\n\n  // Upload Photo\n  const { media } = await client.uploadPhoto(photo)\n  console.log(`https://www.instagram.com/p/${media.code}/`)\n})()\n```\n\n## API Reference\n\n* [Instagram](#instagramcredentials-opts)\n  * [new Instagram({ username, password, cookies, cookieStore }, { language, proxy })](#instagramcredentials-opts)\n  * [.login({ username, password })](#logincredentials)\n  * [.logout()](#logout)\n  * [.getHome()](#gethome)\n  * [.getUserByUsername({ username })](#getuserbyusernameparams)\n  * [.getFollowers({ userId, first, after })](#getfollowersparams)\n  * [.getFollowings({ userId, first, after })](#getfollowingsparams)\n  * [.getActivity()](#getactivity)\n  * [.getProfile()](#getprofile)\n  * [.updateProfile({ name, email, username, phoneNumber, gender, biography, website, similarAccountSuggestions })](#updateprofileparams)\n  * [.changeProfilePhoto({ photo })](#changeprofilephotoparams)\n  * [.deleteMedia({ mediaId })](#deletemediaparams)\n  * [.uploadPhoto({ photo, caption })](#uploadphotoparams)\n  * [.uploadStory({ photo, caption })](#uploadstoryparams)\n  * [.getMediaFeedByLocation({ locationId })](#getmediafeedbylocationparams)\n  * [.getMediaFeedByHashtag({ hashtag })](#getmediafeedbyhashtagparams)\n  * [.locationSearch({ query, latitude, longitude })](#locationsearchparams)\n  * [.getMediaByShortcode({ shortcode })](#getmediabyshortcodeparams)\n  * [.addComment({ mediaId, text })](#addcommentparams)\n  * [.deleteComment({ mediaId, commentId })](#deletecommentparams)\n  * [.getChallenge({ challengeUrl })](#getchallengeparams)\n  * [.updateChallenge({ challengeUrl, choice, securityCode })](#updatechallengeparams)\n  * [.resetChallenge({ challengeUrl })](#resetchallengeparams)\n  * [.replayChallenge({ challengeUrl })](#replaychallengeparams)\n  * [.approve({ userId })](#approveparams)\n  * [.ignore({ userId })](#ignoreparams)\n  * [.follow({ userId })](#followparams)\n  * [.unfollow({ userId })](#unfollowparams)\n  * [.block({ userId })](#blockparams)\n  * [.unblock({ userId })](#unblockparams)\n  * [.like({ mediaId })](#likeparams)\n  * [.unlike({ mediaId })](#unlikeparams)\n  * [.save({ mediaId })](#saveparams)\n  * [.unsave({ mediaId })](#unsaveparams)\n  * [.search({ query, context })](#searchparams)\n  * [.getPhotosByHashtag({hashtag, first, after})](#gethastagphotosparams)\n  * [.getPhotosByUsername({username, first, after})](#getphotosbyusernameparams)\n\n### Instagram(credentials, opts)\n```js\nconst client = new Instagram({ username: '', password: '' }, { language: 'es-CL' })\n```\n> Initializes the client.\n- `credentials`\n  - `username`: The username of account\n  - `password`: The password of account\n  - `cookies`: An optional `Array` of cookies, only needed for restore session. Default is `undefined`\n  - `cookieStore`: An optional [`though-cookie`](https://www.npmjs.com/package/tough-cookie) cookie storage, which allows for persistent cookies. Default is `undefined`\n- `opts`\n  - `language`: The language of response from API. Default is `en-US`\n  - `proxy`: `String` of a proxy to tunnel all requests. Default is `undefined` \n\n### login(credentials)\n```js\nconst { username, password, cookies } = await client.login({ username: '', password: '' })\nconst { authenticated, user } = await client.login({ username: '', password: '' })\n```\n\n> Login in the account, this method returns `user` (`true` when username is valid) and `authenticated` (`true` when login was successful)\n- `credentials`\n  - `username`: The username of account\n  - `password`: The password of account\n\n### logout()\n```js\nawait client.logout()\n```\n> Logout in the account.\n\n### getHome()\n```js\nconst feed = await client.getHome()\n```\n> Get home feed timeline, media shared by the people you follow.\n\n### getUserByUsername(params)\n```js\nconst instagram = await client.getUserByUsername({ username: 'instagram' })\nconst me = await client.getUserByUsername({ username: client.credentials.username })\n```\n> Get user by username, this method not require authentication for public profiles.\n- `params`\n  - `username`: The username of the profile\n\n### getFollowers(params)\n```js\nconst followers = await client.getFollowers({ userId: '1284161654' })\n```\n> Get followers for given userId. Be aware that the response gets slightly altered for easier usage.\n- `params`\n  - `userId`: The user id\n  - `first`: Amount of followers to request. Default is `20`\n  - `after`: Optional `end_cursor` (`String`) for pagination.\n\n### getFollowings(params)\n```js\nconst followings = await client.getFollowings({ userId: '1284161654' })\n```\n> Get followings for given userId. Be aware that the response gets slightly altered for easier usage.\n- `params`\n  - `userId`: The user id\n  - `first`: Amount of followings to request. Default is `20`\n  - `after`: Optional `end_cursor` (`String`) for pagination. \n\n### getActivity()\n```js\nconst activity = await client.getActivity()\n```\n> Get activity of account, news following, liked, etc.\n\n### getProfile()\n```js\nconst profile = await client.getProfile()\n```\n> Get profile the account `first_name`, `last_name`, `email`, `username`, `phone_number`, `gender`, `birthday`, `biography`, `external_url` and `chaining_enabled`.\n\n### updateProfile(params)\n```js\nawait client.updateProfile({ biography: '❤️', website: 'https://jlobos.com/', gender: 1 })\n```\n> Update profile the account.\n- `params`\n  - `name`: The full name. Default is ` `\n  - `email`: The email of account. Default is ` `\n  - `username`: The username of account. Default is `client.credentials.username`\n  - `phoneNumber`: The Phone Number. Default is ` `\n  - `gender`: `Number` `1` male, `2` female and `3` not specified\n  - `biography`: The Bio. Default is ` `\n  - `website`: The Website. Default is ` `\n  - `similarAccountSuggestions`: `Boolean` Include your account when recommending similar accounts people might want to follow. Default is `true`\n\n### changeProfilePhoto(params)\n```js\nconst fs = require('fs')\n\nconst photo = fs.join(__dirname, 'photo.jpg')\nawait client.changeProfilePhoto({ photo })\n```\n> Change the profile photo.\n- `params`\n  - `photo`: A `String` of path file or URL\n\n### deleteMedia(params)\n```js\nawait client.deleteMedia({ mediaId: '1442533050805297981' })\n```\n> Delete a media, photo, video, etc. by the id.\n- `params`\n  - `mediaId`: The media id\n\n### uploadPhoto(params)\n```js\nconst photo = 'https://scontent-scl1-1.cdninstagram.com/t51.2885-15/e35/16465198_658888867648924_4042368904838774784_n.jpg'\nawait client.uploadPhoto({ photo, caption: '❤️' })\n```\n> Upload a photo to Instagram.\n- `params`\n  - `photo`: A `String` of path file or URL\n  - `caption`: The caption of photo. Default is ` `\n\n### uploadStory(params)\n```js\nconst photo = 'https://scontent-scl1-1.cdninstagram.com/t51.2885-15/e35/16465198_658888867648924_4042368904838774784_n.jpg'\nawait client.uploadStory({ photo })\n```\n> Upload a story to Instagram, it only work for images (`jpg`)\n- `params`\n  - `photo`: A `String` of path file or URL\n  - `caption`: The caption of photo. Default is ` `\n\n### getMediaFeedByLocation(params)\n```js\nconst location = await client.getMediaFeedByLocation({ locationId: '26914683' })\n```\n> Get latitude, longitude, top posts, last media, country, city, and more related to the location.\n- `params`\n  - `locationId`: The location id\n\n### getMediaFeedByHashtag(params)\n```js\nconst tag = client.getMediaFeedByHashtag({ hashtag: 'unicorn' })\n```\n> Explore last media and top posts feed related to a hashtag.\n- `params`\n  - `hashtag`: A hashtag, not including the \"#\"\n\n### locationSearch(params)\n```js\nconst venues = client.locationSearch({ query: 'chile', latitude: -33.45, longitude: -70.6667 })\n```\n> Search vanues by latitude and longitude.\n- `params`\n  - `latitude`: Latitude\n  - `longitude`: Longitude\n  - `query`: A optional location name. Default is ` `\n\n### getMediaByShortcode(params)\n```js\nconst media = await client.getMediaByShortcode({ shortcode: 'BQE6Cq2AqM9' })\n```\n> Get data of a media by the Instagram shortcode\n- `params`\n  - `shortcode`: A shortcode\n\n### addComment(params)\n```js\nawait client.addComment({ mediaId: 1442533050805297981, text: 'awesome' })\n```\n> Add comment to a media item.\n- `params`\n  - `mediaId`: The media id\n  - `text`: Comment text\n  - `replyToCommentId`: Optional comment id to which to reply\n\n### deleteComment(params)\n```js\nawait client.deleteComment({ mediaId: '1442533050805297981', commentId: '17848908229146688' })\n```\n> Delete a comment.\n- `params`\n  - `mediaId`: The media id\n  - `commentId`: The comment id\n\n### getChallenge(params)\n```js\nawait client.getChallenge({ challengeUrl: '/challenge/1284161654/a1B2c3d4E6/' })\n```\n> Get information about a challenge.\n- `params`\n  - `challengeUrl`: A `String` with a challenge path\n\n### updateChallenge(params)\n```js\nconst challengeUrl = '/challenge/1284161654/a1B2c3d4E6/'\n\nawait client.updateChallenge({ challengeUrl, choice: 0 })\nawait client.updateChallenge({ challengeUrl, securityCode: 123456  })\n```\n> Request or submit a verification code for the given challenge.\n- `params`\n  - `challengeUrl`: A `String` with a challenge path\n  - `choice`: `Number` `0` for phone and `1` for email. Default is ``\n  - `securityCode`: `Number` the received verification code for the challenge. Default is ``\n\n### resetChallenge(params)\n```js\nawait client.resetChallenge({ challengeUrl: '/challenge/1284161654/a1B2c3d4E6/' })\n```\n> Reset a challenge to start over again.\n- `params`\n  - `challengeUrl`: A `String` with a challenge path\n\n### replayChallenge(params)\n```js\nawait client.replayChallenge({ challengeUrl: '/challenge/1284161654/a1B2c3d4E6/' })\n```\n> Request a new verification message.\n- `params`\n  - `challengeUrl`: A `String` with a challenge path\n\n### approve(params)\n```js\nawait client.approve({ userId: '1284161654' })\n```\n> Approve a friendship request.\n- `params`\n  - `userId`: The user id\n\n### ignore(params)\n```js\nawait client.ignore({ userId: '1284161654' })\n```\n> Reject a friendship request.\n- `params`\n  - `userId`: The user id\n\n### follow(params)\n```js\nawait client.follow({ userId: '1284161654' })\n```\n> Follow a user.\n- `params`\n  - `userId`: The user id\n\n### unfollow(params)\n```js\nawait client.unfollow({ userId: '1284161654' })\n```\n> Unfollow a user.\n- `params`\n  - `userId`: The user id\n\n### block(params)\n```js\nawait client.block({ userId: '1284161654' })\n```\n> Block a user.\n- `params`\n  - `userId`: The user id\n\n### unblock(params)\n```js\nawait client.unblock({ userId: '1284161654' })\n```\n> Unblock a user.\n- `params`\n  - `userId`: The user id\n\n### like(params)\n```js\nawait client.like({ mediaId: '1442533050805297981' })\n```\n> Like a media item.\n- `params`\n  - `mediaId`: The media id\n\n### unlike(params)\n```js\nawait client.unlike({ mediaId: '1442533050805297981' })\n```\n> Unlike a media item.\n- `params`\n  - `mediaId`: The media id\n\n### save(params)\n```js\nawait client.save({ mediaId: '1442533050805297981' })\n```\n> Save a media item.\n- `params`\n  - `mediaId`: The media id\n\n### unsave(params)\n```js\nawait client.unsave({ mediaId: '1442533050805297981' })\n```\n> Unsave a media item.\n- `params`\n  - `mediaId`: The media id\n\n### search(params)\n```js\nawait client.search({ query: 'unicorn' })\n```\n> Search users, places, or hashtags.\n- `params`\n  - `query`: Query\n  - `context`: The context of search, `hashtag`, `place`, `user` or `blended`. Default is `blended`\n  \n  \n  \n### getPhotosByHashtag(params)\n```js\nawait client.getPhotosByHashtag({ hashtag: 'unicorn' })\n```\n> Get photos for hashtag.\n- `params`\n  - `hashtag`: A `String` with a hashtag\n  - `first`:  A `number` of records to return\n  - `after`: The query cursor `String` for pagination\n  \n### getPhotosByUsername(params)\n  ```js\n  await client.getPhotosByUsername({ username: 'unicorn' })\n  ```\n  > Gets user photos.\n  - `params`\n    - `username`: A `String` with a hashtag\n    - `first`:  A `number` of records to return\n    - `after`: The query cursor `String` for pagination\n\n## License\n\nMIT © [Jesús Lobos](https://jlobos.com/)\n","readmeFilename":"README.md"}