1.0.2 • Published 1 year ago

instagram-web.js v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Headless automated instagram activity.

test npm package npm downloads npm bundle size supported node version contributors last commit license

Supported Features

FeatureStatus
Multiple Account
Get user information
Get specific user picture
Get specific user information
Post a picture
Post a video✅ (Chrome required)
Post multiple media

Installation

npm install instagram-web.js

Examples

Get current user information

const { Client, Authentication } = require("instagram-web.js");

const client = new Client({
    authentication: new Authentication({
        username: process.env.IG_USERNAME,
        password: process.env.IG_PASSWORD,
    }),
    puppeteerOptions: {
        headless: true,
        executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    }
});

client.on("authenticated", () => {
    client
        .getInfo()
        .then(info => console.log(info));
})

client.initialize();

Get specific user information

const { Client, Authentication } = require("instagram-web.js");

const client = new Client({
    authentication: new Authentication({
        username: process.env.IG_USERNAME,
        password: process.env.IG_PASSWORD,
    }),
    puppeteerOptions: {
        headless: true,
        executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    }
});

client.on("authenticated", () => {
    client
        .getUser("rifkiiard")
        .then(info => console.log(info));
})

client.initialize();

Get specific user profile

const { Client, Authentication } = require("instagram-web.js");

const client = new Client({
    authentication: new Authentication({
        username: process.env.IG_USERNAME,
        password: process.env.IG_PASSWORD,
    }),
    puppeteerOptions: {
        headless: true,
        executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    }
});

client.on("authenticated", () => {
    client
        .getUserPicture("rifkiiard")
        .then(url => console.log(url));
})

client.initialize();

Post a Feed

const { Client, Authentication, FeedMedia, EVENTS, CROP_SIZES } = require("instagram-web.js");


const client = new Client({
    authentication: new Authentication({
        username: process.env.IG_USERNAME,
        password: process.env.IG_PASSWORD,
    }),
    puppeteerOptions: {
        headless: true,
        executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    }
});

client.on("authenticated", () => {
    client.postFeed({
        media: [
            FeedMedia.fromUrl({
                url: "https://upload.wikimedia.org/wikipedia/id/1/19/Optimus10108pieces.jpg",
                cropSize: CROP_SIZES.ORIGINAL
            }),
            FeedMedia.fromUrl({
                url: "https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4",
                cropSize: CROP_SIZES.ORIGINAL
            }),
        ],
        crop: CROP_SIZES.LANDSCAPE,
        caption: "I am Optimus Prime ..."
    })
})

client.initialize();

LICENSE

instagram-web.js is released under the MIT license.