A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

Overview

instagram-without-api

Instagram Without APIs

Instagram Scraping in August 2022, no credentials required


This is a Node.js library, are you looking for the same in PHP? go to https://orsi.me/instagram-without-api/.

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials (just token from cookies), just Instagram Scraping in 2022 (with cookie and image data in base64).

You can get the latest pictures/information from an account or a single picture/information by id.

📦 npm link

🎮 Demo / Example

⚖️ Licensed under MIT

🤓 Author @orsifrancesco

Offer me a coffee


📦 Installation

npm i instagram-without-api-node

# download the file https://github.com/orsifrancesco/instagram-without-api-node/blob/master/test.js
# add your cookie, user-agent and x-ig-app-id following the next step "How to get Instagram Cookie"

node test.js

🍪 How to get Instagram Cookie

  • Login to Instagram
  • Go to your https://instagram/yourUsername
  • Open your Browser Console (on Chrome just pressing F12)
    1. Select the "Network" tab
    2. Search and click on "timeline/" file; if it is empty just refresh the page
    3. Select "Headers" bar
    4. Be sure the file is Request Method "POST" (if it is "OPTIONS" search the other "timeline/" file in the list)
    5. Scroll down and select "Request Headers" tab
    6. Copy all the code after the word "cookie: " and paste it on _cookie variable
    7. Copy all the code after the word "user-agent: " and paste it on _userAgent variable
    8. Copy all the code after the word "x-ig-app-id: " and paste it on _xIgAppId variable
- don't share your cookie code with anyone!!! it is the same of your credentials
  • That's it, enjoy :)

follow this steps

💻 Images Base64

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).
To solve this problem you will get all the URLs and all the images data in base64.
You can easily show the image data on your project with the following snippets of code:

<img src="data:image/jpg;base64, hereYourBase64String.."/>
.example { background-image: url('data:image/jpg;base64, hereYourBase64String..'); }

Check https://orsifrancesco.github.io/instagram-without-api/how-to-show-base64-images.html for Base64 example.

🎮 Demo / Example

example on https://github.com/orsifrancesco/instagram-without-api-node/blob/master/test.js

const { iwa, iwaId, iwaIdUrl } = require('instagram-without-api-node');

const _cookie = 'mid=Ywj....hFLUdjNT55f0"'      // <!-- required!! please get your cookie from your browser console (6)
const _userAgent = 'Mozilla/5.0.../537.36'      // <!-- required!! please get your user-agent from your browser console (7)
const _xIgAppId = '93661974...'                 // <!-- required!! please get your x-ig-app-id from your browser console (8)

async function fetch() {

    // get the latest 12 feeds from an account (example https://www.instagram.com/orsifrancesco/)

    const responseIwa = await iwa({

        headers: {
            'cookie': _cookie,
            'user-agent': _userAgent,
            'x-ig-app-id': _xIgAppId
        },

        base64images: false,                    // <!-- optional, but without it, you will be not able to store/show images
        maxImages: 2,                           // <!-- optional, 12 is the max number
        file: "instagram-cache.json",           // <!-- optional, instagram-cache.json is by default
        pretty: true,                           // <!-- optional, prettyfy json true/false
        time: 3600,                             // <!-- optional, reload contents after 3600 seconds by default

        id: "orsifrancesco"                     // <!-- id is required

    })

    console.log({ responseIwa });



    // get picture and info from instagram id url (example https://www.instagram.com/p/Cgczi6qMuh1/)

    const responseIwaIdUrl = await iwaIdUrl({

        headers: {
            'cookie': _cookie,
            'user-agent': _userAgent,
            'x-ig-app-id': _xIgAppId
        },

        base64images: false,                    // <!-- optional, but without it, you will be not able to store/show images
        file: "instagram-cache-byidurl.json",   // <!-- optional, instagram-cache.json is by default
        pretty: true,                           // <!-- optional, prettyfy json true/false
        time: 3600,                             // <!-- optional, reload contents after 3600 seconds by default

        id: "Cgczi6qMuh1"                       // <!-- id is required

    })

    console.log({ responseIwaIdUrl });



    // get picture and info from instagram id (2890411760684296309 is the id of https://www.instagram.com/p/Cgczi6qMuh1/)

    const responseIwaId = await iwaId({

        headers: {
            'cookie': _cookie,
            'user-agent': _userAgent,
            'x-ig-app-id': _xIgAppId
        },

        base64images: false,                    // <!-- optional, but without it, you will be not able to store/show images
        file: "instagram-cache-byid.json",      // <!-- optional, instagram-cache.json is by default
        pretty: true,                           // <!-- optional, prettyfy json true/false
        time: 3600,                             // <!-- optional, reload contents after 3600 seconds by default

        id: "2890411760684296309"               // <!-- id is required

    })

    console.log({ responseIwaId });

}
fetch()

🕹️ JSON outputs

output example for iwa function on https://github.com/orsifrancesco/instagram-without-api/blob/master/instagram-cache.json

[
  {
    "id": "2696840872190940431",
    "time": 1635708506,
    "imageUrl": "https://scontent-lcy1-1.cdninstagram.com/v/t51.2885-15/e35/p1080x1080/249938862_1214260935751176_32...",
    "likes": 18,
    "comments": 0,
    "link": "https://www.instagram.com/p/CVtGnwashUP/",
    "text": "#helloworld #domain #check",
    "image": "/9j/4AAQSkZJRgABAQAAAQABAAD/7QB8UGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGA............."
  },
  {
    "id": "2654027113529608497",
    "time": 1630604708,
    "imageUrl": "https://scontent-lcy1-1.cdninstagram.com/v/t51.2885-15/e35/p1080x1080/241221239_8640769...",
    "likes": 38,
    "comments": 0,
    "link": "https://www.instagram.com/p/CTU_5keMAkx/",
    "text": "#london #uk #unitedkingdom #tube #underground #overground #sunrise #morning #morningvibes #sky #metro #line #prospective",
    "image": "/9j/4AAQSkZJRgABAQAAAQABAAD/7QB8UGhvdG9zaG9wIDMuMAA4Qkl..........."
  }
]

output example for iwaId or iwaIdUrl functions

[
  {
    "id": "289855367...",
    "width": 1385,
    "height": 1731,
    "imageUrl": "https:\/\/scontent-lhr8-1.cdnin...",
    "time": 1659754546,
    "topLikers": [
        "franko"
    ],
    "likes": 32,
    "commentCount": 2,
    "comments": [
      {
        "time": 1659756069,
        "text": "This is a comment...",
        "user": {
          "username": "test",
          "fullName": "DearTest",
          "imageUrl": "https:\/\/scontent-lhr8-1.cdninstagram.com..."
        }
      }
    ],
    "link": "https:\/\/www.instagram.com\/p\/Cgczi6qMuh1\/",
    "text": "If you know it, you know it...",
    "user": {
      "username": "orsifrancesco",
      "fullName": "Frank",
      "imageUrl": "https:\/\/scontent-lhr8-1.cd..."
    },
    "image": "\/9j\/4AAQSkZJR....Q=="
  }
]

⚖️ License

Licensed under MIT

About

Any feedback to @orsifrancesco and/or coffee is welcome :)

You might also like...

Blobernize your pictures with this all-new tool! Still under development, but it works for now.

Blobernize your pictures with this all-new tool! Still under development, but it works for now.

Still under development, but in a usable state image-blobernizer A very simple image-blobernizer made for the webbrowser using p5.js Live demo Require

Mar 23, 2022

Generate prime numbers from pictures!

Generate prime numbers from pictures!

Pictoprime This is a program used to generate prime numbers from pictures. Dependencies Ensure you have the following dependencies: Node.js (16+ suppo

Dec 27, 2022

A jQuery Plugin for viewing pictures like Wechat moments

A jQuery Plugin for viewing pictures like Wechat moments

A jQuery Plugin for viewing pictures like Wechat moments

Nov 10, 2022

NFTKastle is an NFT marketplace where users can mint their pictures as NFTs, list their NFTs for sale, and buy NFTs from other users.

NFTKastle NFTKastle is an NFT marketplace where users can mint their pictures as NFTs, list their NFTs for sale, and buy NFTs from other users. NFTKas

Oct 31, 2022

💥This is an app that recognizes text in pictures

English | 简体中文 Easy OCR App This is an app that recognizes text in pictures. The application is developed using Tauri, Vite, React, TypeScript. The ca

Dec 3, 2022

This project is built with JavaScript, Webpack, HTML & CSS, Leaderboard api. When user clicks on Refresh button it hits the api and responds with the data, The user can also post data to the api

This project is built with JavaScript, Webpack, HTML & CSS, Leaderboard api. When user clicks on Refresh button it hits the api and responds with the data, The user can also post data to the api

leaderboad Description the project. this project is about the leaderboad i did during Microverse to build a website for adding Data to the API and fet

May 30, 2022

VS Code extension that adds a red error squiggle to every word in your code.

VS Code extension that adds a red error squiggle to every word in your code.

Dumbisense Dumbisense is a VS Code extension that adds a red error squiggle to every word in your code, with an interesting error message and dino ima

Sep 3, 2022

Get a desktop notification every time a new correction slot is available for your 42 project.

42_slot_watcher A simple node.js corrections slots watcher for 42, working on Windows - MacOS - Linux. What is this I was bored of having to refresh t

Dec 20, 2022

Get an isolated preview database for every Netlify Preview Deployment

Get an isolated preview database for every Netlify Preview Deployment

Netlify Preview Database Plugin Create an isolated preview database for each preview deployment in Netlify Quickstart • Website • Docs • Discord • Twi

Nov 16, 2022
Comments
  • Fetch more posts

    Fetch more posts

    Is it possible to fetch more posts from Instagram?

    I am trying to fetch from a profile, but it only returns 32 posts, and the page has many more.

    Thanks

    opened by skhaz 1
Owner
Francesco Orsi
Francesco Orsi
Monitor your code for exposed API keys, tokens, credentials, and high-risk security IaC misconfigurations

Spectral VS Code extension The Spectral VS Code extension is a tool for developers that want to catch security issues (such as credentials, tokens and

null 15 Dec 19, 2022
Instagram.css - Complete set of Instagram filters in pure CSS

Instagram.css Instagram.css - Pure CSS Instagram filters. You can add all these Instagram-like filters to your photos with using CSS only. Thanks to t

Yan Zhu 4k Dec 30, 2022
Lavanstax project - Makes it easy and fun to use İnstagram. Also first userbot for İnstagram

Lavanstax Lavanstax project - Makes it easy and fun to use İnstagram. Also first userbot for İnstagram | İnstagram | Telegram Channel | Telegram Group

Berathan Yedibela 19 Oct 15, 2022
Deploy an Architect project from GitHub Actions with keys gathered from aws-actions/configure-aws-credentials

Deploy an Architect project from GitHub Actions with keys gathered from a specific AWS IAM Role federated by an IAM OIDCProvider. CloudFormation to cr

Taylor Beseda 4 Apr 6, 2022
A Node.js AI chatbot with unlimited context and chat history.

Memory Bot Memory Bot is an AI chatbot built with Node.js to demonstrate unlimited context and chat history for more cost-efficient context-aware conv

Gordon Mickel 6 May 10, 2023
Uniform, Unlimited, Universal and Unbelievable Annotation Toolbox

特性 ?? 本项目包含@label-u/annotation、@label-u/components、@label-u/utils及@label-u/web等4个工程。 ?? 采用rollup esbuild插件及vite编译,让开发者上高速,开发效率更高 ?? 采用lerna进行多工程管理。 ??

OpenDataLab 16 Dec 23, 2022
A simple class to embed a panoramic view in a website from six pictures

htmlcubemap A simple class to embed a panoramic view in a website from six pictures. It uses CSS with transforms. Demo here Usage Just call from javas

Javi Agenjo 6 Dec 17, 2022
Scrape data from Instagram without applying for the authenticated API 🎯

scraper-instagram Scrape data from Instagram without applying for the authenticated API. Getting started Prerequisites NodeJS NPM or Yarn Install From

fabi.stehle 11 Jan 5, 2023
Get follower count for Instagram, Twitter, TikTok, Youtube accounts

?? You can help the author become a full-time open-source maintainer by sponsoring him on GitHub. follower-count Install npm i follower-count Example

EGOIST 96 Dec 16, 2022
A short project to automatically upload multiple pictures to pinata.cloud

Papel Mache Papel Mache is an app that uploads pictures to IPFS through pinata.cloud Requirements pinata/sdk: 1.1.14 node: 14.17.6 Node Node installat

Cardano Valley 7 Aug 18, 2022