ahmdrz / goinsta

Unofficial Instagram API written in Golang
MIT License
895 stars 247 forks source link

How to use Next with Sync to get latest posts in hashtags? #344

Closed websines closed 3 years ago

websines commented 3 years ago

This is my code, I want to run it in an infinite loop and whenever an user makes a new post with the hashtag this function will print its ShortCode. How to use Sync() to do it?

` func GetNewPostsFromTags() {

h := Insta.NewHashtag("hashtag")
for {
    for h.Next() {
        for i := range h.Sections {
            for _, i := range h.Sections[i].LayoutContent.Medias {
                fmt.Println(i.Item.Code)
            }
        }
    }
}

} `