shitgram
Version:
A JavaScript library to make requests to Instagram
205 lines (151 loc) • 11.7 kB
Markdown
<p align="center">
<img src="https://a.kyouko.se/eUhh.png" width="200" height="200"><br>
<b>A JavaScript library to make requests to Instagram</b>
<br><br>
<a href="https://npmjs.com/package/shitgram"><img src="https://img.shields.io/npm/v/shitgram?style=flat-square" alt="Version"></a>
<img src="https://img.shields.io/node/v/shitgram?style=flat-square" alt="Node">
<img src="https://img.shields.io/david/shitgram/node-shitgram?style=flat-square" alt="Dependencies">
<a href="https://github.com/shitgram/node-shitgram/blob/master/LICENSE"><img src="https://img.shields.io/github/license/shitgram/node-shitgram?style=flat-square" alt="License"></a>
</p>
## Contents
- [Installation](#installation)
- [Example](#example)
- [Documentation](#documentation)
- [Plugins](#plugins)
## Installation
```
$ yarn add shitgram
```
## Example
```js
const Shitgram = require('shitgram');
const shitgram = new Shitgram();
shitgram.user('tenasatupitsyn')
.then(function(user) {
// Handle success
console.log(data);
/*
{ id: '7661979279',
url: 'https://www.instagram.com/tenasatupitsyn',
avatarURL: 'https://instagram.frec8-1.fna.fbcdn.net/vp/d5...',
isPrivate: false,
isVerified: false,
isBusiness: true,
businessCategory: 'Creators & Celebrities',
username: 'tenasatupitsyn',
fullName: 'Tenasa M. Tupitsyn',
biography: 'YuGi TeNaSa 1010.\nLara/VE 🇻🇪',
email: null,
website: null,
followers: 0,
following: 0,
posts: 0 }
*/
})
.catch(function(error) {
// Handle error
console.log(error);
});
```
## Documentation
### new Shitgram(credentials) ⇒ [Constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor)
- **`credentials`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `username`<br>
Instagram account username
- `password`<br>
Instagram account password
- `sessionID`<br>
An instagram session id. Will be used if you have not set `username` and `password`.
You will not need to set a session id if you have already set username and password.
### getSessionID ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Generate a new session id or return a defined sessionID
If username and password are set, a new session id will always be generated. So that a unique session id will be returned set property sessionID in the credentials.
It is possible to get the session ID without the builder by using [plug-in](#plugins).
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### getUserDataWithSession(params) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get user data that is only available with a session id
- **`params`**
- `userID` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_
- `sessionID` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### getUserStoriesWithSession(params) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get user stories that is only available with a session id
- **`params`**
- `userID` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_
- `sessionID` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### getUserHighlightsWithSession(params) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get user highlight that is only available with a session id
- **`params`**
- `userID` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_
- `sessionID` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### user(param, options) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get user details
- **`param`** : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
`Username` or `link` for the user profile you want details about
- **`options`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `defaultResponse`<br>
Set `true` to return instagram default response, `false` is set to default.
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### story(param, options) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get story details
- **`param`** : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
`Username` or `link` for the user stories you want details about
- **`options`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `defaultResponse`<br>
Set `true` to return default response from storiesig.com or if you have set credentials the response will be from instagram.com, `false` is set to default.
- `exclude`<br>
The file type to [exclude](https://github.com/shitgram/node-shitgram/blob/master/enums/EExcludeType.js) from the response, will not exclude if **defaultResponse** is `true`.
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### highlight(param, options) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get highlight details
- **`param`** : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
`Highlight id` or `link` to it
- **`options`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `defaultResponse`<br>
Set `true` to return instagram default response, `false` is set to default.
- `exclude`<br>
The file type to [exclude](https://github.com/shitgram/node-shitgram/blob/master/enums/EExcludeType.js) from the response, will not exclude if **defaultResponse** is `true`.
Highlights will be returned if they have been set by the author to be shared, check availability of highlights in the `canReshare` property; if null, highlights will be an empty array.
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### image(param, options) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get image post details
- **`param`** : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
`Post code` or `link` to it
- **`options`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `defaultResponse`<br>
Set `true` to return instagram default response, `false` is set to default.
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### video(param, options) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get video post details
- **`param`** : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
`Post code` or `link` to it
- **`options`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `defaultResponse`<br>
Set `true` to return instagram default response, `false` is set to default.
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### album(param, options) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Get album post details
- **`param`** : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
Album `post code` or `link` to it
- **`options`** : [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) _(Optional)_
- `defaultResponse`<br>
Set `true` to return instagram default response, `false` is set to default.
- `exclude`<br>
The file type to [exclude](https://github.com/shitgram/node-shitgram/blob/master/enums/EExcludeType.js) from the response, will not exclude if **defaultResponse** is `true`.
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
### ExcludeType : _enum<[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>_
File type to exclude from response
Available properties: `IMAGE` - `VIDEO`
## Plugins
### Session(params) ⇒ [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
Generate a new csrfToken and sessionID from Instagram username and password
- **`params`**
- `username` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
Instagram account username
- `password` : [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) _(Required)_<br>
Instagram account password
A brief example of use [here](https://github.com/shitgram/node-shitgram/blob/master/examples/generate_session.example.js)
**Returns**: [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) — Returned promise
[BACK TO TOP](#readme)