Skip to content

05. Discover & IGTV

David Brouwer edited this page Nov 13, 2021 · 1 revision

Discover

Discover is the discover or explore page on the Instagram app. To access the discover page you can use the insta.Discover instance. When you call insta.Login(), or insta.OpenApp(), the first few results on the discover page will be fetched automatically. If you want to fetch (more) results from the discover page, you can call insta.Discover.Next(). What is different about the discover page, is that all media items are not listed sequentially, but in sections. Therefore you can find the results of the latest fetch in insta.Discover.Clusters, but all media items will be automatically be copied over to insta.Discover.Items.

The basic functionality of the discover page has been implemented, but not all features as of now. E.g. the pagination of individual discovery results has not been implemented. If you would like to see this please let me know, and I'll see what I can do.

IGTV

IGTV itself stands for a special type of Instagram post. However, there is more to it than just the longer video clips. If a single user has posted IGTV videos, you can find them on their profile, these can be fetched by either calling insta.VisitProfile(username) or user.IGTV(). IGTV also has a discovery section on its own, however, which contains only IGTV videos, and currently live broadcasts. To find this IGTV Discovery section in the app, you have to first find an IGTV post (hint: #igtv), and click on "Watch IGTV Video" > "Browse IGTV". In goinsta, this has also been implemented:

igtv := insta.IGTV
if !igtv.Next() {
    log.Fatal(igtv.Error())
}

fmt.Println("Found %d IGTV posts\n", len(igtv.Items))

As with the 'regular' discover page, the endpoint does not return the items in a simple list, but in a nested structure which can be found in insta.IGTV.DestinationItems. All media posts will be copied over to insta.IGTV.Items

If you want to discover broadcasts (account that are currently live), IGTV Discover also provides that feature:

igtv := insta.IGTV
result := igtv.Live()

// Type []Broadcast
broadcasts := result.Broadcasts

// Pick one
broadcast := broadcasts[0]

// Sync info
err := broadcast.Info()
if err != nil {
    log.Fatal(err)
}

// Other Broadcast methods
func (br *Broadcast) GetComments() (*BroadcastComments, error)
func (br *Broadcast) GetHeartbeat() (*BroadcastHeartbeat, error)
func (br *Broadcast) GetLikes() (*BroadcastLikes, error)
Clone this wiki locally