Skip to content

Commit

Permalink
fix: followers params
Browse files Browse the repository at this point in the history
  • Loading branch information
Davincible committed Sep 15, 2022
1 parent fc6c215 commit 1837cc6
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions users.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ func (users *Users) Next() bool {
insta := users.insta
endpoint := users.endpoint

query := map[string]string{
"max_id": users.NextID,
"ig_sig_key_version": instaSigKeyVersion,
"rank_token": insta.rankToken,
query := map[string]string{}
if users.NextID != "" {
query["max_id"] = users.NextID
}

if _, ok := users.query["rank_token"]; !ok {
users.query["rank_token"] = generateUUID()
}

for key, value := range users.query {
Expand Down Expand Up @@ -105,9 +108,9 @@ func (users *Users) Next() bool {

users.setValues()

// Dont't return false on first error otherwise for loop won't run
if users.NextID == "" {
users.err = ErrNoMore
return false
}

return true
Expand Down Expand Up @@ -389,17 +392,20 @@ func (user *User) followList(url, query string, order FollowOrder) *Users {
insta: user.insta,
endpoint: fmt.Sprintf(url, user.ID),
query: map[string]string{
"includes_hashtags": "true",
"search_surface": "follow_list_page",
"query": query,
"enable_groups": "true",
"search_surface": "follow_list_page",
"query": query,
"enable_groups": "true",
},
}

if order != DefaultOrder {
users.query["order"] = string(order)
}

if url == urlFollowing {
users.query["includes_hashtags"] = "true"
}

return &users
}

Expand Down

0 comments on commit 1837cc6

Please sign in to comment.