ig-data
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

ig-data

Get urls to images and videos of Instagram posts and profile pictures.

Server and browser compatible.

By Nino Filiu

Installation

npm i ig-data

Usage

Full API is defined in ./dist/ig-data.d.ts. Examples:

import igdata from 'ig-data';
// or import { publication, user } from 'ig-data';
// or const igdata = require('ig-data')
// or const { publication, user } = require('ig-data')
 
// resolve to publication data
igdata.publication.fromShortcode('Bl0-uj6gHdf');
igdata.publication.fromUrl('https://www.instagram.com/p/Bl0-uj6gHdf/');
igdata.publication.fromSource('<!DOCTYPE html> ... </html>');
 
// resolve to user data
igdata.user.fromUsername('ssttaacckkyy');
igdata.user.fromUrl('https://www.instagram.com/ssttaacckkyy/');
igdata.user.fromSource('<!DOCTYPE html> ... </html>');

Example publication data of this post:

import { publication } from 'ig-data';
 
publication
    .fromUrl('https://www.instagram.com/p/Bl0-uj6gHdf/')
    .then(console.log);
 
const shouldLog = {
    shortcode: 'Bl0-uj6gHdf',
    sidecar: false,
    location: {
        id: '6889842',
        has_public_page: true,
        name: 'Paris, France',
        slug: 'paris-france',
        address_json: '{"street_address": "", "zip_code": "", "city_name": "Paris, France", "region_name": "", "country_code": "FR", "exact_city_match": true, "exact_region_match": false, "exact_country_match": false}'
    },
    media: {
        type: 'image',
        width: 1080,
        height: 1080,
        src: 'https://scontent-frt3-2.cdninstagram.com/vp/874d6761ff772b268e1dd3cef4696e0e/5CFC1A9D/t51.2885-15/e35/37718770_269787300466545_3893520744407105536_n.jpg?_nc_ht=scontent-frt3-2.cdninstagram.com'
    }
}

Example user data of this user:

import { user } from 'igdata';
 
user
    .fromUsername('ssttaacckkyy')
    .then(console.log);
 
const shouldLog = {
    id: '2182883331',
    username: 'ssttaacckkyy',
    fullName: 'Nino Filiu',
    biography: 'Hacker & photographer\nBerlin/Paris',
    isPrivate: false,
    isVerified: false,
    profilePicture: 'https://scontent-frt3-2.cdninstagram.com/vp/bf3698c858fc67a633507db49b4df84e/5CFB30C1/t51.2885-19/s320x320/14726320_180793242372154_238303271121321984_a.jpg?_nc_ht=scontent-frt3-2.cdninstagram.com',
    followers: 1425,
    follows: 595,
    externalUrl: null
}

Readme

Keywords

Package Sidebar

Install

npm i ig-data

Weekly Downloads

2

Version

1.2.2

License

MIT

Unpacked Size

239 kB

Total Files

5

Last publish

Collaborators

  • nino-filiu