instagram-private-api-auth
v1.0.1
Published
Wrapper for instagram-private-api with Two Factor Authentication (2FA) and simple console interface
Downloads
14
Readme
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://[email protected]/dilame/instagram-private-api.git
npm install git+https://[email protected]/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))