Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/transitive-bullshit/puppeteer-instagram

Instagram automation driven by headless chrome.
https://github.com/transitive-bullshit/puppeteer-instagram

automation headless-chrome instagram instagram-bot puppeteer

Last synced: about 1 month ago
JSON representation

Instagram automation driven by headless chrome.

Awesome Lists containing this project

README

        

# puppeteer-instagram

> [Instagram](https://instagram.com) automation driven by headless chrome.

[![NPM](https://img.shields.io/npm/v/puppeteer-instagram.svg)](https://www.npmjs.com/package/puppeteer-instagram) [![Build Status](https://travis-ci.com/transitive-bullshit/puppeteer-instagram.svg?branch=master)](https://travis-ci.com/transitive-bullshit/puppeteer-instagram) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

This module also has a [CLI](https://github.com/transitive-bullshit/puppeteer-instagram-cli).

## Install

```bash
npm install --save puppeteer-instagram
```

## Usage

This example signs into an [Instagram](https://instagram.com) account.

```js
const PuppeteerInstagram = require('puppeteer-instagram')

const instagram = new PuppeteerInstagram()

await instagram.signin({ username: 'xxx', password: 'xxx' })
await instagram.close()
```

## API

#### Table of Contents

- [PuppeteerInstagram](#puppeteerinstagram)
- [isAuthenticated](#isauthenticated)
- [user](#user)
- [browser](#browser)
- [signup](#signup)
- [signin](#signin)
- [signout](#signout)
- [verifyEmail](#verifyemail)
- [close](#close)

### [PuppeteerInstagram](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L21-L175)

[Instagram](https://instagram.com) automation driven by headless chrome.

Type: `function (opts)`

- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`)
- `opts.browser` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Puppeteer browser instance to use
- `opts.puppeteer` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Puppeteer [launch options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions)

* * *

#### [isAuthenticated](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L32-L32)

Whether or not this instance is authenticated with Instagram.

Type: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)

* * *

#### [user](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L39-L39)

Authenticated user if authenticated with Instagram.

Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)

* * *

#### [browser](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L46-L52)

Puppeteer Browser instance to use.

Type: `function ()`

* * *

#### [signup](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L68-L100)

Automates the creation of a new Instagram account.

Type: `function (user, opts): Promise`

- `user` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** User details for new account
- `user.email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Email
- `user.username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Username
- `user.firstName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** First name
- `user.lastName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Last name
- `user.password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Password
- `opts` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`)
- `opts.verify` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Whether or not to verify email
- `opts.emailPassword` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Email password for verification

* * *

#### [signin](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L114-L130)

Signs into an existing Instagram account.

Note: either username or email is required.

Type: `function (user, opts): Promise`

- `user` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** User details for new account
- `user.username` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Username
- `user.email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Email
- `user.password` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Password
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`)

* * *

#### [signout](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L136-L142)

Signs out of the currently authenticated Instagram account.

Type: `function (): Promise`

* * *

#### [verifyEmail](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L152-L161)

Verifies the authenticated Instagram account's email via `puppeteer-email`.

Type: `function (opts): Promise`

- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options
- `opts.emailPassword` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Email password for verification
- `opts.email` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Email verification (defaults to user's GitHub email)

* * *

#### [close](https://github.com/transitive-bullshit/puppeteer-instagram/blob/3241815ee3d5ae673c485c829d04fba4f349ac12/index.js#L168-L174)

Closes the underlying browser instance, effectively ending this session.

Type: `function (): Promise`

* * *

## Related

- [puppeteer-instagram-cli](https://github.com/transitive-bullshit/puppeteer-instagram-cli) - CLI for this module.
- [puppeteer-email](https://github.com/transitive-bullshit/puppeteer-email) - Email automation driven by headless chrome.
- [puppeteer](https://github.com/GoogleChrome/puppeteer) - Headless Chrome Node API.
- [awesome-puppeteer](https://github.com/transitive-bullshit/awesome-puppeteer) - Curated list of awesome puppeteer resources.

## Somewhat Related

- [private api](https://github.com/mgp25/Instagram-API) - Instagram's private API (php)
- [instabot.py](https://github.com/instabot-py/instabot.py) - Popular Instagram bot (python)
- [instagram-node](https://github.com/totemstech/instagram-node) - Deprecated node SDK (javascript)
- [node-instagram](https://github.com/pradel/node-instagram) - More recent node SDK (javascript)

## License

MIT © [Travis Fischer](https://github.com/transitive-bullshit)

Support my OSS work by following me on twitter twitter