Skip to content

Commit

Permalink
Merge pull request #8 from timolins/proxy-support
Browse files Browse the repository at this point in the history
Added proxy support
  • Loading branch information
jlobos authored Feb 26, 2018
2 parents 3b9b5ab + 69dc42a commit 3a62439
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const credentialsFile = joinPath(__dirname, 'credentials.json')
## API Reference

* [Instagram](#instagramcredentials-opts)
* [new Instagram({ username, password, cookies }, { language })](#instagramcredentials-opts)
* [new Instagram({ username, password, cookies }, { language, proxy })](#instagramcredentials-opts)
* [.login({ username, password })](#logincredentials)
* [.logout()](#logout)
* [.getHome()](#gethome)
Expand Down Expand Up @@ -137,6 +137,7 @@ const client = new Instagram({ username: '', password: '' }, { language: 'es-CL'
- `cookies`: A `Array` of cookies, optional only is need for restore session. Default is `undefined`
- `opts`
- `language`: The language of response from API. Default is `en-US`
- `proxy`: `String` of a proxy to tunnel all requests. Default is `undefined`

### login(credentials)
```js
Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const userAgent =
'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1'

class Instagram {
constructor({ username, password, cookies }, { language } = {}) {
constructor({ username, password, cookies }, { language, proxy } = {}) {
this.credentials = {
username,
password,
Expand All @@ -35,6 +35,7 @@ class Instagram {
'X-CSRFToken': csrftoken,
Referer: baseUrl
},
proxy,
timeout: 30000,
json: true,
jar
Expand Down

0 comments on commit 3a62439

Please sign in to comment.