Skip to content

Commit

Permalink
Add Highlights Support
Browse files Browse the repository at this point in the history
  • Loading branch information
zanechua committed Aug 17, 2020
1 parent e85a0f6 commit 4de393f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,50 @@ class Instagram {
})
}

async getHighlightReels({
highlightReelIds = [],
reelIds = [],
locationIds = [],
precomposedOverlay = false
} = {}) {
return this.request('/graphql/query/', {
qs: {
query_hash: '45246d3fe16ccc6577e0bd297a5db1ab',
variables: JSON.stringify({
highlight_reel_ids: highlightReelIds,
reel_ids: reelIds,
location_ids: locationIds,
precomposed_overlay: precomposedOverlay
})
}
}).then(data => data.data.reels_media)
}

async getHighlightsByUsername({ username }) {
const user = await this.getUserByUsername({ username })
return this.request('/graphql/query/', {
qs: {
query_hash: '7c16654f22c819fb63d1183034a5162f',
variables: JSON.stringify({
user_id: user.id,
include_chaining: true,
include_reel: true,
include_suggested_users: false,
include_logged_out_extras: false,
include_highlight_reels: true
})
}
})
.then(data => data.data.user.edge_chaining)
.then(({ edges }) => edges.map(edge => edge.node))
}

async getHighlightItemsByReel({ highlightReelId }) {
const reels = await this.getHighlightReels({ highlightReelIds: [highlightReelId] })
if (reels.length === 0) return []
return reels[0].items
}

async _getFollowData({ fieldName, queryHash, variables }) {
return this.request('/graphql/query/', {
qs: {
Expand Down

0 comments on commit 4de393f

Please sign in to comment.