-
Notifications
You must be signed in to change notification settings - Fork 58
Home
This documentation is unfinished, and a work in progress
Goinsta provides an interface to communicate with the Instagram API the Android APK uses. As such, it provides access to various singular endpoints, yet also methods that will perform a sequence of calls, just like the app will do. The Instagram.VisitProfile(user)
method, for example, will perform a search for a user, register the result, load in the profile information, feed posts, stories, and highlights, and subsequently return the result.
Disclaimer: This code is in no way affiliated with, authorized, maintained, sponsored, or endorsed by Instagram or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk. It is prohibited to use this API to spam users or the platform in any way.
All of the Instagram interactions happen through the Instagram struct.
import "github.com/Davincible/goinsta"
func main() {
insta := goinsta.New("<username>", "<password>")
...
}
The Instagram.New
method will generate all necessary unique identifiers, and instantiate all child structs. The various child structs contain the more specific methods.
// Timeline provides access to your timeline
Timeline *Timeline
// Discover provides access to the discover/explore page
Discover *Discover
// Profiles provides methods for interaction with other user's profiles
Profiles *Profiles
// IGTV allows you to fetch the IGTV Discover page
IGTV *IGTV
// Account stores all personal data of the user and his/her options.
Account *Account
// Collections represents your collections with saved posts
Collections *Collections
// Searchbar provides methods to access IG's search functionalities
Searchbar *Search
// Activity provides access to Instagram notifications
Activity *Activity
// Inbox provides to Instagram's message/chat system
Inbox *Inbox
// Feed provides access to secondary feeds such as user's and hashtag's feeds
Feed *Feed
// Contacts provides address book sync/unsync methods
Contacts *Contacts
// Locations provide feed by location ID. To find location feeds by name use Searchbar
Locations *LocationInstance
// Challenge stores the challenge info if provided
Challenge *Challenge
// TwoFactorInfo enabled 2FA
TwoFactorInfo *TwoFactorInfo
With the Instagram instance created, valid authentication headers need to be fetched by logging in.
...
err := insta.Login()
if err != nil {
...
}
The Instagram.Login
method will perform a sequence of calls imitating an app login. It will automatically fetch the first few posts on your timeline, stories, and discover page. After calling insta.Login()
, you can access the first timeline posts by calling insta.Timeline
...
// All currently fetched timeline posts
posts := insta.Timeline.Items
// Slice of all currently fetched story groups (a group represents one user, one user can have multiple story items)
stories := insta.Timeline.Tray.Stories
// Like the first post
posts[0].Like()
// Select the first user in the tray, and reply to their first story
stories[0].Items[0].Reply("Happy Birthday!")
Disclaimer: This code is in no way affiliated with, authorized, maintained, sponsored, or endorsed by Instagram or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk. It is prohibited to use this API to spam users or the platform in any way.