Skip to content

Commit

Permalink
Add endpoint Timeline.NewFeedPostsExist
Browse files Browse the repository at this point in the history
  • Loading branch information
Davincible committed Aug 21, 2021
1 parent 1cd30c5 commit bb3f658
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
7 changes: 4 additions & 3 deletions const.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ const (
urlSearchRegisterClick = "fbsearch/register_recent_search_click/"

// Feeds
urlFeedLocationID = "feed/location/%d/"
urlFeedLocations = "locations/%d/sections/"
urlFeedTag = "feed/tag/%s/"
urlFeedLocationID = "feed/location/%d/"
urlFeedLocations = "locations/%d/sections/"
urlFeedTag = "feed/tag/%s/"
urlFeedNewPostsExist = "feed/new_feed_posts_exist/"

// Media
urlMediaInfo = "media/%s/info/"
Expand Down
20 changes: 20 additions & 0 deletions timeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,26 @@ func (tl *Timeline) Refresh() error {
return nil
}

// NewFeedPostsExist will return true if new feed posts are available.
func (tl *Timeline) NewFeedPostsExist() (bool, error) {
insta := tl.insta

body, err := insta.sendSimpleRequest(urlFeedNewPostsExist)
if err != nil {
return false, err
}

var resp struct {
NewPosts bool `json:"new_feed_posts_exist"`
Status string `json:"status"`
}
err = json.Unmarshal(body, &resp)
if err != nil {
return false, err
}
return resp.NewPosts, nil
}

// Stories is a helper function to get the stories
func (tl *Timeline) Stories() []Reel {
return tl.Tray.Stories
Expand Down

0 comments on commit bb3f658

Please sign in to comment.