instagram-private-api-auth

1.0.1 • Public • Published

instagram-private-api-auth


Wrapper for instagram-private-api that support Two Factor Authentication (2FA) and have simple console interface.


Installation

npm install instagram-private-api
npm install instagram-private-api-auth

or

npm install git+https://git@github.com/dilame/instagram-private-api.git
npm install git+https://git@github.com/ini0n/instagram-private-api-auth.git

Example

Get session by credentials and get last user media in profile.

const Client = require('instagram-private-api').V1
const AuthService = require('instagram-private-api-auth').AuthService(Client)
const _ = require('lodash')

async function getLastUserMedia(session, userId) {
    const feed = new Client.Feed.UserMedia(session, userId)
    const lastMedias = await feed.get()
    return _.head(lastMedias)
}

async function main() {
    try {
        // AuthService.getSession(username:string, password:string, proxyUrl?:string)
        const userSession = await AuthService.getSession('username', 'password')
        const account = await userSession.getAccount()
        let lastUserMedia = await getLastUserMedia(userSession, account.params.id)
        // lastUserMedia should be Media {}
        console.log(lastUserMedia)
    } catch (error) { 
        console.log(error)
    }
}

main().finally(() => process.exit(1))

Readme

Keywords

Package Sidebar

Install

npm i instagram-private-api-auth

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

12.3 kB

Total Files

7

Last publish

Collaborators

  • id_xz