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

instagram-hashtag-scrapper

v1.0.3

Published

NPM module for loading images from Instagram by hashtag without API access by means of scraping.

Downloads

16

Readme

Instagram Hashtag Scrapper

NodeJS module for loading media from Instagram by hashtag, individual media and location media without API access by means of scraping.

Disclamer

Instagram has gone to great lengths to prevent scraping and other unauthorized access to their public content. This module is dependant on the markup the public-facing instagram.com. Should that change this module might also stop working as intended. It also only loads the 17 posts that are displayed on first-load without following pagination to load more images. You should take this into consideration when deciding whether this module will work for you.

Installation

npm install instagram-hashtag-scrapper

Usage

The most basic usage will allow you to load the first 17 posts for any given hashtag with basic info and URLs to the full post media.

Tage page scraping

var ig = require('instagram-hashtag-scrapper');

ig.scrapeTagPage('miami').then(function(result){
    console.dir(result);
})

Example response:

{
    "total": 5854,
    "count": 17,
    "media": [{
        "code": "BMm39DKD6DB",
        "date": 1478733183,
        "dimensions": {
            "width": 750,
            "height": 750
        },
        "comments_disabled": false,
        "comments": {
            "count": 0
        },
        "caption": "Lorem ipsum... #quote #margaretmead #restmycase",
        "likes": {
            "count": 52
        },
        "owner": {
            "id": "393767493"
        },
        "thumbnail_src": "https://instagram.fosl1-1.fna.fbcdn.net/t51.2885-15/s640x640/sh0.08/e35/14719160_341462716214777_3017677686123266048_n.jpg?ig_cache_key=MTM4MDAzNjQyMzY3MTg0OTE1Mw%3D%3D.2",
        "is_video": false,
        "id": "1380036423671849153",
        "display_src": "https://instagram.fosl1-1.fna.fbcdn.net/t51.2885-15/s750x750/sh0.08/e35/14719160_341462716214777_3017677686123266048_n.jpg?ig_cache_key=MTM4MDAzNjQyMzY3MTg0OTE1Mw%3D%3D.2"
    }
}

As you can see, only the basic info required for listing images is returned. If you need further info, like more info about the owner of the post or the location, you can perform these queries separately or all in one go with the included deepScrapeTagPage method which populates the original tag page response with the corresponding data from the postPage and locationPage methods.

Deep tag page scraping

var ig = require('instagram-hashtag-scrapper');

ig.deepScrapeTagPage('miami').then(function(result){
    console.dir(result);
})

The response from this call is so vast that to see what it contains I recommend you perform it and log out the result.

Post page scraping

The post page scraping method takes a code argument (like the one returned for each post via the scrapeTagPage).

var ig = require('instagram-hashtag-scrapper');

ig.scrapePostPage('B0EktnOgLqq').then(function(result){
    console.dir(result);
})

Location Page Scraping

The location page scraping method takes a numeric id argument (like the one returned for each post via the scrapeTagPage) and returns lat/lng coordinates for the post location among many other things.

var ig = require('instagram-hashtag-scrapper');

ig.scrapeLocationPage(542401).then(function(result){
    console.dir(result);
})