ig-headless-driver
v1.0.12
Published
Scrape instagram posts by username, shortcode, or hashtag
Downloads
28
Maintainers
Readme
ig-headless-driver
This is a package that will go scrape instagram posts by username or hashtag.
It's response does NOT depend on loaded HTML, and is less suceptible to page changes.
It taps into public endpoints in Instagram's API, which they frequently make breaking changes to.
Something something read instagrams terms of service
Usage
import driver from 'ig-headless-driver'
// or use
const driver = require('ig-headless-driver')
// username string should NOT include @
let username = 'officialrickastley'
// shortcode string should NOT include slashes or leading /p/
// https://www.instagram.com/p/B2CZwZpAnzl/
let shortcode = 'B2CZwZpAnzl'
// tag should NOT include #
let tag = 'THEBESTOFME'
const userData = await driver.getUser(username)
const postData = await driver.getPost(shortcode)
const tagData = await driver.getTag(tag)
console.log(userData) // {JSON object containing user data and timeline post data}
Available Methods
Currently there are three exposed methods to gather data:
driver.getUser(username)
driver.getPost(shortcode)
driver.getTag(tag)
Each method returns a JSON object, already parsed.
Each method is asyncronous
Each method is probably against Instagram's ToS for business use. I don't know, nobody reads those things.