Documentation
¶
Overview ¶
Package igmedia helps you get all URLs of posts of a specific Instagram user, and also media (photos and videos) links of posts.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EdgeMedia ¶
type EdgeMedia struct { Typename string `json:"__typename"` Shortcode string `json:"shortcode"` Dimensions struct { Height int64 `json:"height"` Width int64 `json:"width"` } `json:"dimensions"` DisplayUrl string `json:"display_url"` DisplayResources []struct { Src string `json:"src"` ConfigWidth int64 `json:"config_width"` ConfigHeight int64 `json:"config_height"` } `json:"display_resources"` VideoUrl string `json:"video_url"` IsVideo bool `json:"is_video"` TakenAtTimestamp int64 `json:"taken_at_timestamp"` Location struct { Id string `json:"id"` HasPublicPage bool `json:"has_public_page"` Name string `json:"name"` Slug string `json:"slug"` } `json:"location"` EdgeSidecarToChildren struct { Edges []struct { Node EdgeMedia `json:"node"` } `json:"edges"` } `json:"edge_sidecar_to_children"` }
type IGApiManager ¶
type IGApiManager struct {
// contains filtered or unexported fields
}
func NewInstagramApiManager ¶
func NewInstagramApiManager(ds_user_id, sessionid, csrftoken string) *IGApiManager
After login to Instagram, you can get the cookies of *ds_user_id*, *sessionid*, *csrftoken* in Chrome Developer Tools. See https://stackoverflow.com/a/44773079 or https://github.com/hoschiCZ/instastories-backup#obtain-cookies
func (*IGApiManager) GetAllPostCode ¶
func (m *IGApiManager) GetAllPostCode(username string) (codes []string, err error)
Given user name, return codes of all posts of the user. TODO: add sleep at the end of forloop. If the number of posts is over 2400, Instagram API will return http response code 429 (Too Many Requests)
func (*IGApiManager) GetPostInfo ¶
func (m *IGApiManager) GetPostInfo(code string) (em EdgeMedia, err error)
Given code of post, return information of the post with login status.
func (*IGApiManager) GetUserInfo ¶
func (m *IGApiManager) GetUserInfo(username string) (ui UserInfo, err error)
Given user name, return information of the user name.
type UserInfo ¶
type UserInfo struct { Biography string `json:"biography"` ExternalUrl string `json:"external_url"` FullName string `json:"full_name"` Id string `json:"id"` IsPrivate bool `json:"is_private"` ProfilePicUrlHd string `json:"profile_pic_url_hd"` Username string `json:"username"` Media struct { Nodes []struct { Code string `json:"code"` // url of the post Date int64 `json:"date"` Caption string `json:"caption"` } `json:"nodes"` Count int64 `json:"count"` PageInfo struct { HasNextPage bool `json:"has_next_page"` EndCursor string `json:"end_cursor"` } `json:"page_info"` } `json:"media"` }
func GetUserInfoNoLogin ¶
Given user name, return information of the user name without login.
Example ¶
user, err := GetUserInfoNoLogin("instagram") if err != nil { panic(err) } fmt.Println(user.Id) fmt.Println(user.Biography)
Output: 25025320 Discovering — and telling — stories from around the world. Curated by Instagram’s community team.