├── .gitignore ├── package.json ├── LICENSE ├── test.js ├── README.md └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Numerous always-ignore extensions 2 | *.diff 3 | *.err 4 | *.orig 5 | *.log 6 | *.rej 7 | *.swo 8 | *.swp 9 | *.vi 10 | *~ 11 | *.sass-cache 12 | node_modules/ 13 | .tmp/ 14 | 15 | # OS or Editor folders 16 | .DS_Store 17 | Thumbs.db 18 | .cache 19 | .project 20 | .settings 21 | .tmproj 22 | *.esproj 23 | nbproject 24 | *.sublime-project 25 | *.sublime-workspace 26 | *.komodoproject 27 | .komodotools 28 | _notes 29 | dwsync.xml 30 | package-lock.json -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "instagram-without-api-node", 3 | "version": "1.0.12", 4 | "description": "A simple Node.js code to get unlimited instagram public pictures by every user and tag without api, without credentials (just token from cookies), just Instagram Scraping (with cookie and image data in base64).", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "instagram", 11 | "scraping", 12 | "without credentials", 13 | "without api", 14 | "no credentials", 15 | "no api" 16 | ], 17 | "author": "Francesco Orsi", 18 | "license": "MIT", 19 | "repository": { 20 | "type": "git", 21 | "url": "git+https://github.com/orsifrancesco/instagram-without-api-node.git" 22 | }, 23 | "bugs": { 24 | "url": "https://github.com/orsifrancesco/instagram-without-api-node/issues" 25 | }, 26 | "homepage": "https://orsi.me/instagram-without-api/", 27 | "dependencies": { 28 | "image-to-base64": "^2.2.0", 29 | "request": "^2.88.2" 30 | } 31 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Francesco Orsi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | const { iwaTag, iwa, iwaId, iwaIdUrl } = require('instagram-without-api-node'); 2 | 3 | const _cookie = 'mid=ZDQvkQALAAFaW...a865efce"'; 4 | const _userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'; 5 | const _xIgAppId = '93661...459'; 6 | 7 | async function fetch() { 8 | 9 | // get the latest 12 feeds from a tag (example https://instagram.com/explore/tags/love) 10 | 11 | const responseIwaTag = await iwaTag({ 12 | 13 | group: 'recent', // 32 | 33 |
34 | 35 | ## 📦 Installation 36 | 37 | ```bash 38 | npm i instagram-without-api-node 39 | 40 | # download the file https://github.com/orsifrancesco/instagram-without-api-node/blob/master/test.js 41 | # add your cookie, user-agent and x-ig-app-id following the next step "How to get Instagram Cookie" 42 | 43 | node test.js 44 | ``` 45 | 46 | ## 🍪 How to get Instagram Cookie 47 | 48 | - Login to Instagram 49 | - Go to your https://instagram/yourUsername 50 | - Open your Browser Console (on Chrome just pressing F12) 51 | 1. Select the "Network" tab 52 | 2. Search and click on "timeline/" file; if it is empty just refresh the page 53 | 3. Select "Headers" bar 54 | 4. Be sure the file is Request Method "POST" (if it is "OPTIONS" search the other "timeline/" file in the list) 55 | 5. Scroll down and select "Request Headers" tab 56 | 6. Copy all the code after the word "cookie: " and paste it on `_cookie` variable 57 | 7. Copy all the code after the word "user-agent: " and paste it on `_userAgent` variable 58 | 8. Copy all the code after the word "x-ig-app-id: " and paste it on `_xIgAppId` variable 59 | ```diff 60 | - don't share your cookie code with anyone!!! it is the same of your credentials 61 | ``` 62 | - That's it, enjoy :) 63 | 64 | ![follow this steps](https://user-images.githubusercontent.com/6490641/181632823-42fb2308-4c3f-421a-848a-58cefcf98915.png "follow this steps") 65 | 66 | ## 💻 Images Base64 67 | Although you can get the URLs of the images, Instagram doesn't give you the possibility to include and showing those images on your projects (they will be automatically blocked from their servers).\ 68 | To solve this problem you will get all the URLs and all the images data in base64.\ 69 | You can easily show the image data on your project with the following snippets of code: 70 | 71 | ```html 72 | 73 | ``` 74 | ```css 75 | .example { background-image: url('data:image/jpg;base64, hereYourBase64String..'); } 76 | ``` 77 | 78 | Check https://orsifrancesco.github.io/instagram-without-api/how-to-show-base64-images.html for Base64 example. 79 | 80 | ## 🛕 Cool Project Example 81 | ![sniffagram](https://user-images.githubusercontent.com/6490641/232155875-ce2ea2ec-eeb5-4bcc-9af7-8c8d82887420.svg "sniffagram") 82 | 83 | ## 🎮 Demo / Example 84 | example on https://github.com/orsifrancesco/instagram-without-api-node/blob/master/test.js 85 | 86 | ```js 87 | const { iwaTag, iwa, iwaId, iwaIdUrl } = require('instagram-without-api-node'); 88 | 89 | const _cookie = 'mid=Ywj....hFLUdjNT55f0"' //