npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

insta-api

v1.2.5

Published

An Instragram API that doesn't rely on Instagram's deprecating API.

Downloads

11

Readme

insta-api

An Instragram API that doesn't rely on Instagram's deprecating API.

Installing

npm install insta-api

Usage

Importing the module

let Instagram = require('insta-api');
let instagram = new Instagram("Enter your session id. Grab from your cookies in a browser");

getUserInfo(username)

instagram.getUserInfo('joshuadun').then((userInfo) => {
    console.log('Biography: ' + userInfo.biography)
})

Returns: Biography: I'm not sentimental. This skin and bones is a rental.

getPosts(username or userid)

instagram.getPosts('tylerrjoseph', {num: 10}).then(async (data) => {
    let myData = {}
    myData.receivedPosts = data.posts.length
    let firstPost = data.posts[0]
    myData.firstPost = {shortcode: firstPost.shortcode}


    //Posts have two functions: getPostMedia and getComments
    let urls = await firstPost.getPostMedia()
    myData.firstPost.firstMedia = urls[0]
    let commentData = await firstPost.getComments({num: 1})
    myData.firstPost.firstComment = commentData.comments[0].text
    console.log(myData)
})

Returns:

{
    receivedPosts: 10,
    firstPost: {
        shortcode: 'BU5BbaagEUV',
        firstMedia: 'https://instagram.fbna1-2.fna.fbcdn.net/vp/1da0b84d63b19903b8a2f0584dd3573f/5C004BFB/t51.2885-15/e35/18812609_1875010279425214_5576153514956029952_n.jpg',
        firstComment: 'Post betch'
    }
}

getPostFromShortcode(shortcode)

instagram.getPostByShortcode('BlSBbgSgZRh').then((post) => {
    console.log(`${post.url} has ${post.likes} likes and ${post.comments} comments`)
})

Returns https://instagram.com/p/BlSBbgSgZRh has 400083 likes and 16279 comments

getStories(username or userid)

instagram.getStories('djkhaled').then((data) => {
    console.log(data.stories.length + ' stories')
    console.log(data.stories[0].url)
})

Returns:

{total: 54, first: 'https://instagram.fbna1-2.fna.fbcdn.net/vp/4d8ce1d14e6acd1cb75ce11a3f31bc4e/5B67C6AD/t50.12441-16/37886089_2108992515842077_1764245142725384721_n.mp4'}

getID(username)

instagram.getID('instagram').then((id) => {
    console.log(id)
})

Returns: 25025320