Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

instagrapi

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instagrapi

Library to obtain information from an Instagram account in a friendly and intuitive way

  • 3.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-62.5%
Maintainers
1
Weekly downloads
 
Created
Source

Instagrapi

Library to obtain information from an Instagram account in a friendly and intuitive way.

The library works as a wrapper for the basic Instagram API, to abstract long or confusing property names and have a clean and readable data structure.

Created with NodeJS and Typescript, all types are exposed for use. Logo typescript + 💗

🌐 Demo website

Installation

  • NPM
npm install instagrapi
  • CDN
<!-- Bundle to development -->
<script src="https://cdn.jsdelivr.net/npm/instagrapi@3/dist/bundle/instagrapi.js"></script>

<!-- Bundle optimized to production -->
<script src="https://cdn.jsdelivr.net/npm/instagrapi@3/dist/bundle/instagrapi.min.js"></script>
  • DOWNLOAD

Download the bundle from jsdelivr selecting instagrapi.js or instagrapi.min.js and create the corresponding file in your assets.

Usage

const { instagrapi } = require('instagrapi');

instagrapi.getProfile('USERNAME').then(profile => {
  console.log(profile.followers); // Numbers followers of instagram account
});

Using typescript and async/await.

import { instagrapi, TPost, TComment } from 'instagrapi';

async function getComments(): Promise<string[] | undefined> {
  try {
    const post: TPost = await instagrapi.getPost('POST_URL');

    const comments: string[] = post.lastComments.map(
      (comment: TComment) => comment.content
    );

    console.log(comments); // Last comments of the post

    return comments;
  } catch (error) {
    console.error(error);
  }
}

getComments();

Methods

  • getProfile(<USERNAME>)

Get all the profile information of an instagram account. Receives as argument: <USERNAME>, the username of the instagram account.

Type of output in typescript:

type TProfile = {
  username: string;
  image: {
    standard: string;
    hd: string;
  };
  qtyPosts: number;
  followers: number;
  followed: number;
  name: string;
  biography: string;
  externalUrl: string;
  isBusiness: boolean;
  isVerified: boolean;
  isPrivate: boolean;
};
  • getLastPosts(<USERNAME>)

Get the last 12 posts of an instagram account. Receives as argument: <USERNAME>, the username of the instagram account.

Type of output in typescript:

type TLastPosts = Array<{
  postUrl: string;
  image: string;
  video: null | {
    url: string;
    views: number | null;
  };
  content: string | null;
  likes: number;
  qtyComments: number;
}>;
  • getPost(<POST_URL>):

Get all the details of a post of an instagram account. Receives as argument <POST_URL>, the url of the post on instagram.

Type of output in typescript:

type TPost = {
  postUrl: string;
  image: {
    standard: string;
    hd: string;
  };
  video: TVideo | null;
  content: string | null;
  likes: number;
  qtyComments: number;
  media: Array<TMedia>;
  author: {
    username: string;
    image: string;
    qtyPosts: number;
    followers: number;
    name: string;
    isVerified: boolean;
    isPrivate: boolean;
  };
  lastComments: Array<TComment>;
  location: null | {
    country: string | null;
    region: string | null;
    city: string | null;
    street: string | null;
    zipCode: string | null;
  };
  date: string;
};

License

MIT License © Edixon Piña

Keywords

FAQs

Package last updated on 14 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc