Skip to content

Commit

Permalink
Merge pull request #120 from jlobos/PR_65
Browse files Browse the repository at this point in the history
Add getPrivateProfilesFollowRequests based on PR#65
  • Loading branch information
revall authored May 19, 2020
2 parents 2599df4 + fda705f commit 30997ed
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const client = new Instagram({ username, password, cookieStore })
## API Reference

* [Instagram](#instagramcredentials-opts)
* [new Instagram({ username, password, cookieStore }, { language, proxy })](#instagramcredentials-opts)
* [new Instagram({ username, password, cookieStore }, { language, proxy, requestOptions })](#instagramcredentials-opts)
* [.login({ username, password })](#logincredentials)
* [.logout()](#logout)
* [.getHome()](#gethome)
Expand Down Expand Up @@ -123,6 +123,7 @@ const client = new Instagram({ username, password, cookieStore })
* [.search({ query, context })](#searchparams)
* [.getPhotosByHashtag({hashtag, first, after})](#gethastagphotosparams)
* [.getPhotosByUsername({username, first, after})](#getphotosbyusernameparams)
* [.getPrivateProfilesFollowRequests(cursor)](#getPrivateProfilesFollowRequests)

### Instagram(credentials, opts)
```js
Expand Down Expand Up @@ -456,6 +457,11 @@ await client.getPhotosByHashtag({ hashtag: 'unicorn' })
- `first`: A `number` of records to return
- `after`: The query cursor `String` for pagination

### getPrivateProfilesFollowRequests
```js
await client.getPrivateProfilesFollowRequests(cursor)
```

## License

MIT © [Jesús Lobos](https://jlobos.com/)
9 changes: 8 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Instagram {

// Temporary work around for https://github.com/jlobos/instagram-web-api/issues/118
const createEncPassword = pwd => {
return `#PWD_INSTAGRAM_BROWSER:0:${Date.now()}:${pwd}`;
return `#PWD_INSTAGRAM_BROWSER:0:${Date.now()}:${pwd}`
}

// Login
Expand Down Expand Up @@ -488,6 +488,13 @@ class Instagram {
.get('/graphql/query/', options)
.then(response => response.data.user)
}

async getPrivateProfilesFollowRequests(cursor) {
const cursorParam = cursor ? `&cursor=${cursor}` : ''
return this.request(
`accounts/access_tool/current_follow_requests?__a=1${cursorParam}`
)
}
}

module.exports = Instagram
5 changes: 5 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,8 @@ test('getPhotosByHashtag', async t => {
const { status } = await client.search({ hashtag: 'Instagram' })
t.is(status, 'ok')
})

test('getPrivateProfilesFollowRequests', async t => {
const { page_name } = await client.getPrivateProfilesFollowRequests()
t.is(page_name, 'current_follow_requests')
})

0 comments on commit 30997ed

Please sign in to comment.