import "github.com/ahmdrz/goinsta"
account.go activity.go challenge.go comments.go const.go contacts.go feeds.go generator.go goinsta.go hashtags.go inbox.go location.go media.go profiles.go request.go search.go shortid.go timeline.go types.go users.go utils.go
const ( MuteAll muteOption = "all" MuteStory muteOption = "story" MuteFeed muteOption = "feed" )
ErrNoMore is an error that comes when there is no more elements available on the list.
Export exports selected *Instagram object options to an io.Writer
GetBest returns best quality image or video.
Arguments can be []Video or []Candidate
type Account struct { ID int64 `json:"pk"` Username string `json:"username"` FullName string `json:"full_name"` Biography string `json:"biography"` ProfilePicURL string `json:"profile_pic_url"` Email string `json:"email"` PhoneNumber string `json:"phone_number"` IsBusiness bool `json:"is_business"` Gender int `json:"gender"` ProfilePicID string `json:"profile_pic_id"` CanSeeOrganicInsights bool `json:"can_see_organic_insights"` ShowInsightsTerms bool `json:"show_insights_terms"` Nametag Nametag `json:"nametag"` HasAnonymousProfilePicture bool `json:"has_anonymous_profile_picture"` IsPrivate bool `json:"is_private"` IsUnpublished bool `json:"is_unpublished"` AllowedCommenterType string `json:"allowed_commenter_type"` IsVerified bool `json:"is_verified"` MediaCount int `json:"media_count"` FollowerCount int `json:"follower_count"` FollowingCount int `json:"following_count"` GeoMediaCount int `json:"geo_media_count"` ExternalURL string `json:"external_url"` HasBiographyTranslation bool `json:"has_biography_translation"` ExternalLynxURL string `json:"external_lynx_url"` HdProfilePicURLInfo PicURLInfo `json:"hd_profile_pic_url_info"` HdProfilePicVersions []PicURLInfo `json:"hd_profile_pic_versions"` int `json:"usertags_count"` HasChaining bool `json:"has_chaining"` ReelAutoArchive string `json:"reel_auto_archive"` PublicEmail string `json:"public_email"` PublicPhoneNumber string `json:"public_phone_number"` PublicPhoneCountryCode string `json:"public_phone_country_code"` ContactPhoneNumber string `json:"contact_phone_number"` Byline string `json:"byline"` SocialContext string `json:"social_context,omitempty"` SearchSocialContext string `json:"search_social_context,omitempty"` MutualFollowersCount float64 `json:"mutual_followers_count"` LatestReelMedia int64 `json:"latest_reel_media,omitempty"` CityID int64 `json:"city_id"` CityName string `json:"city_name"` AddressStreet string `json:"address_street"` DirectMessaging string `json:"direct_messaging"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Category string `json:"category"` BusinessContactMethod string `json:"business_contact_method"` IsCallToActionEnabled bool `json:"is_call_to_action_enabled"` FbPageCallToActionID string `json:"fb_page_call_to_action_id"` Zip string `json:"zip"` AllowContactsSync bool `json:"allow_contacts_sync"` CanBoostPost bool `json:"can_boost_post"` // contains filtered or unexported fields }
Account is personal account object
See examples: examples/account/*
Archived returns current account archive feed
For pagination use FeedMedia.Next()
ChangePassword changes current password.
GoInsta does not store current instagram password (for security reasons) If you want to change your password you must parse old and new password.
See example: examples/account/changePass.go
Feed returns current account feed
params can be: string: timestamp of the minimum media timestamp.
minTime is the minimum timestamp of media.
For pagination use FeedMedia.Next()
Followers returns a list of user followers.
See example: examples/account/followers.go
Following returns a list of user following.
See example: examples/account/following.go
Liked are liked publications
PendingFollowRequests returns pending follow requests.
RemoveProfilePic removes current profile picture
This function updates current Account information.
See example: examples/account/removeProfilePic.go
func (account *Account) Saved() (*SavedMedia, error)
Saved returns saved media.
SetBiography changes your Instagram's biography.
This function updates current Account information.
SetPrivate sets account to private mode.
This function updates current Account information.
See example: examples/account/setPrivate.go
SetPublic sets account to public mode.
This function updates current Account information.
See example: examples/account/setPublic.go
func (account *Account) Stories() *StoryMedia
Stories returns account stories.
Use StoryMedia.Next for pagination.
See example: examples/account/stories.go
Sync updates account information
Tags returns media where account is tagged in
For pagination use FeedMedia.Next()
type Activity struct {
// contains filtered or unexported fields
}
Activity is the activity of your instagram account
You can get Recent and Following activities.
func (act *Activity) Following() *FollowingActivity
Following allows to receive recent following activity.
See example: examples/activity/following.go
func (act *Activity) Recent() *MineActivity
Recent allows to receive recent activity (notifications).
Use Activities.Next to paginate over activities.
See example: examples/activity/recent.go
type BlockedUser struct { // TODO: Convert to user UserID int64 `json:"user_id"` Username string `json:"username"` FullName string `json:"full_name"` ProfilePicURL string `json:"profile_pic_url"` BlockAt int64 `json:"block_at"` }
BlockedUser stores information about a used that has been blocked before.
func (b *BlockedUser) Unblock() error
Unblock unblocks blocked user.
type Broadcast struct { ID int64 `json:"id"` BroadcastStatus string `json:"broadcast_status"` DashManifest string `json:"dash_manifest"` ExpireAt int64 `json:"expire_at"` EncodingTag string `json:"encoding_tag"` InternalOnly bool `json:"internal_only"` NumberOfQualities int `json:"number_of_qualities"` CoverFrameURL string `json:"cover_frame_url"` BroadcastOwner User `json:"broadcast_owner"` PublishedTime int64 `json:"published_time"` MediaID string `json:"media_id"` BroadcastMessage string `json:"broadcast_message"` OrganicTrackingToken string `json:"organic_tracking_token"` }
Broadcast is live videos.
type Candidate struct { Width int `json:"width"` Height int `json:"height"` URL string `json:"url"` }
Candidate is something that I really have no idea what it is.
type Caption struct { ID int64 `json:"pk"` UserID int64 `json:"user_id"` Text string `json:"text"` Type int `json:"type"` CreatedAt int64 `json:"created_at"` CreatedAtUtc int64 `json:"created_at_utc"` ContentType string `json:"content_type"` Status string `json:"status"` BitFlags int `json:"bit_flags"` User User `json:"user"` DidReportAsSpam bool `json:"did_report_as_spam"` MediaID int64 `json:"media_id"` HasTranslation bool `json:"has_translation"` }
Caption is media caption
type Challenge struct { StepName string `json:"step_name"` StepData ChallengeStepData `json:"step_data"` LoggedInUser *Account `json:"logged_in_user,omitempty"` UserID int64 `json:"user_id"` NonceCode string `json:"nonce_code"` Action string `json:"action"` Status string `json:"status"` // contains filtered or unexported fields }
sendSecurityCode sends the code received in the message
type ChallengeError struct { Message string `json:"message"` Challenge struct { URL string `json:"url"` APIPath string `json:"api_path"` HideWebviewHeader bool `json:"hide_webview_header"` Lock bool `json:"lock"` Logout bool `json:"logout"` NativeFlow bool `json:"native_flow"` } `json:"challenge"` Status string `json:"status"` ErrorType string `json:"error_type"` }
ChallengeError is error returned by HTTP 400 status code.
func (e ChallengeError) Error() string
type ChallengeStepData struct { Choice string `json:"choice"` FbAccessToken string `json:"fb_access_token"` BigBlueToken string `json:"big_blue_token"` GoogleOauthToken string `json:"google_oauth_token"` Email string `json:"email"` SecurityCode string `json:"security_code"` ResendDelay interface{} `json:"resend_delay"` ContactPoint string `json:"contact_point"` FormType string `json:"form_type"` }
type Comment struct { ID int64 `json:"pk"` Text string `json:"text"` Type int `json:"type"` User User `json:"user"` UserID int64 `json:"user_id"` BitFlags int `json:"bit_flags"` ChildCommentCount int `json:"child_comment_count"` CommentIndex int `json:"comment_index"` CommentLikeCount int `json:"comment_like_count"` ContentType string `json:"content_type"` CreatedAt int64 `json:"created_at"` CreatedAtUtc int64 `json:"created_at_utc"` DidReportAsSpam bool `json:"did_report_as_spam"` HasLikedComment bool `json:"has_liked_comment"` InlineComposerDisplayCondition string `json:"inline_composer_display_condition"` OtherPreviewUsers []User `json:"other_preview_users"` PreviewChildComments []Comment `json:"preview_child_comments"` NextMaxChildCursor string `json:"next_max_child_cursor,omitempty"` HasMoreTailChildComments bool `json:"has_more_tail_child_comments,omitempty"` NextMinChildCursor string `json:"next_min_child_cursor,omitempty"` HasMoreHeadChildComments bool `json:"has_more_head_child_comments,omitempty"` NumTailChildComments int `json:"num_tail_child_comments,omitempty"` NumHeadChildComments int `json:"num_head_child_comments,omitempty"` Status string `json:"status"` // contains filtered or unexported fields }
Comment is a type of Media retrieved by the Comments methods
Like likes comment.
Unlike unlikes comment.
type Comments struct { Items []Comment `json:"comments"` CommentCount int64 `json:"comment_count"` Caption Caption `json:"caption"` CaptionIsEdited bool `json:"caption_is_edited"` HasMoreComments bool `json:"has_more_comments"` HasMoreHeadloadComments bool `json:"has_more_headload_comments"` ThreadingEnabled bool `json:"threading_enabled"` MediaHeaderDisplay string `json:"media_header_display"` InitiateAtTop bool `json:"initiate_at_top"` InsertNewCommentToTop bool `json:"insert_new_comment_to_top"` PreviewComments []Comment `json:"preview_comments"` NextMaxID json.RawMessage `json:"next_max_id,omitempty"` NextMinID json.RawMessage `json:"next_min_id,omitempty"` CommentLikesEnabled bool `json:"comment_likes_enabled"` DisplayRealtimeTypingIndicator bool `json:"display_realtime_typing_indicator"` Status string `json:"status"` // contains filtered or unexported fields }
Comments allows user to interact with media (item) comments. You can Add or Delete by index or by user name.
Add push a comment in media.
If parent media is a Story this function will send a private message replying the Instagram story.
See example: examples/media/commentsAdd.go
Del deletes comment.
DelByID removes comment using id.
See example: examples/media/commentsDelByID.go
DelMine removes all of your comments limited by parsed parameter.
If limit is <= 0 DelMine will delete all your comments.
See example: examples/media/commentsDelMine.go
Disable disables comments in FeedMedia.
See example: examples/media/commentDisable.go
Enable enables comments in FeedMedia
See example: examples/media/commentEnable.go
Next allows comment pagination.
New comments are stored in Comments.Items
Sync prepare Comments to receive comments. Use Next to receive comments.
See example: examples/media/commentsSync.go
type ConfigFile struct { ID int64 `json:"id"` User string `json:"username"` DeviceID string `json:"device_id"` UUID string `json:"uuid"` RankToken string `json:"rank_token"` Token string `json:"token"` PhoneID string `json:"phone_id"` Cookies []*http.Cookie `json:"cookies"` }
ConfigFile is a structure to store the session information so that can be exported or imported.
type Contact struct { Numbers []string `json:"phone_numbers"` Emails []string `json:"email_addresses"` Name string `json:"first_name"` }
type Contacts struct {
// contains filtered or unexported fields
}
func (c *Contacts) SyncContacts(contacts *[]Contact) (*SyncAnswer, error)
type Conversation struct { ID string `json:"thread_id"` V2ID string `json:"thread_v2_id"` // Items can be of many types. Items []InboxItem `json:"items"` Title string `json:"thread_title"` Users []User `json:"users"` LeftUsers []User `json:"left_users"` Pending bool `json:"pending"` PendingScore int64 `json:"pending_score"` int `json:"reshare_receive_count"` int `json:"reshare_send_count"` ViewerID int64 `json:"viewer_id"` ValuedRequest bool `json:"valued_request"` LastActivityAt int64 `json:"last_activity_at"` Muted bool `json:"muted"` IsPin bool `json:"is_pin"` Named bool `json:"named"` ThreadType string `json:"thread_type"` ExpiringMediaSendCount int `json:"expiring_media_send_count"` ExpiringMediaReceiveCount int `json:"expiring_media_receive_count"` Inviter User `json:"inviter"` HasOlder bool `json:"has_older"` HasNewer bool `json:"has_newer"` LastSeenAt map[string]struct { Timestamp string `json:"timestamp"` ItemID string `json:"item_id"` } `json:"last_seen_at"` NewestCursor string `json:"newest_cursor"` OldestCursor string `json:"oldest_cursor"` IsSpam bool `json:"is_spam"` LastPermanentItem Item `json:"last_permanent_item"` // contains filtered or unexported fields }
Conversation is the representation of an instagram already established conversation through direct messages.
func (c Conversation) Error() error
func (c *Conversation) Like() error
Like sends heart to the conversation
See example: examples/media/likeAll.go
func (c *Conversation) Next() bool
Next loads next set of private messages.
See example: examples/inbox/conversation.go
func (c *Conversation) Send(text string) error
Send sends message in conversation
See example: examples/inbox/sms.go
func (c *Conversation) Write(b []byte) (int, error)
Write is like Send but being compatible with io.Writer.
func (ec ErrChallengeProcess) Error() string
type Error400 struct { ChallengeError Action string `json:"action"` StatusCode string `json:"status_code"` Payload struct { ClientContext string `json:"client_context"` Message string `json:"message"` } `json:"payload"` Status string `json:"status"` }
Error400 is error returned by HTTP 400 status code.
Error503 is instagram API error
type ErrorN struct { Message string `json:"message"` Status string `json:"status"` ErrorType string `json:"error_type"` }
ErrorN is general instagram error
type Feed struct {
// contains filtered or unexported fields
}
Feed is the object for all feed endpoints.
func (feed *Feed) LocationID(locationID int64) (*FeedLocation, error)
Feed search by locationID
Tags search by Tag in user Feed
(sorry for returning FeedTag. See #FeedTag)
type FeedLocation struct { RankedItems []Item `json:"ranked_items"` Items []Item `json:"items"` NumResults int `json:"num_results"` NextID string `json:"next_max_id"` MoreAvailable bool `json:"more_available"` AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"` MediaCount int `json:"media_count"` Location Location `json:"location"` Status string `json:"status"` }
FeedLocation is the struct that fits the structure returned by instagram on LocationID search.
type FeedMedia struct { Items []Item `json:"items"` NumResults int `json:"num_results"` MoreAvailable bool `json:"more_available"` AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"` Status string `json:"status"` // Can be int64 and string // this is why we recommend Next() usage :') NextID interface{} `json:"next_max_id"` // contains filtered or unexported fields }
FeedMedia represent a set of media items
Delete deletes all items in media. Take care...
See example: examples/media/mediaDelete.go
ID returns media id.
Next allows pagination after calling: User.Feed Params: ranked_content is set to "true" by default, you can set it to false by either passing "false" or false as parameter. returns false when list reach the end. if FeedMedia.Error() is ErrNoMore no problem have been occurred.
SetID sets media ID this value can be int64 or string
SetInstagram set instagram
Sync updates media values.
type FeedTag struct { RankedItems []Item `json:"ranked_items"` Images []Item `json:"items"` NumResults int `json:"num_results"` NextID string `json:"next_max_id"` MoreAvailable bool `json:"more_available"` AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"` Story StoryMedia `json:"story"` Status string `json:"status"` // contains filtered or unexported fields }
FeedTag is the struct that fits the structure returned by instagram on TagSearch.
Error returns hashtag error
Next paginates over hashtag feed.
type FollowingActivity struct { AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"` NextID int64 `json:"next_max_id"` Stories []struct { Type int `json:"type"` StoryType int `json:"story_type"` Args struct { MediaDestination string `json:"media_destination"` Destination string `json:"destination"` Text string `json:"text"` Links []struct { Start int `json:"start"` End int `json:"end"` Type string `json:"type"` ID string `json:"id"` } `json:"links"` ProfileID int64 `json:"profile_id"` ProfileImage string `json:"profile_image"` SecondProfileID int64 `json:"second_profile_id"` SecondProfileImage string `json:"second_profile_image"` ProfileImageDestination string `json:"profile_image_destination"` Media []struct { ID string `json:"id"` Image string `json:"image"` } `json:"media"` Timestamp int64 `json:"timestamp"` Tuuid string `json:"tuuid"` } `json:"args"` Counts struct { } `json:"counts"` Pk string `json:"pk"` } `json:"stories"` Status string `json:"status"` // contains filtered or unexported fields }
FollowingActivity is the latest activity of the people you are following
func (act *FollowingActivity) Error() error
func (act *FollowingActivity) Next() bool
Next allows pagination over following recent activity.
See example:
type Friendship struct { IncomingRequest bool `json:"incoming_request"` FollowedBy bool `json:"followed_by"` OutgoingRequest bool `json:"outgoing_request"` Following bool `json:"following"` Blocking bool `json:"blocking"` IsPrivate bool `json:"is_private"` Muting bool `json:"muting"` IsMutingReel bool `json:"is_muting_reel"` }
Friendship stores the details of the relationship between two users.
type Hashtag struct { Name string `json:"name"` Sections []struct { LayoutType string `json:"layout_type"` LayoutContent struct { // F*ck you instagram. // Why you do this f*cking horribly structure?!? // Media []Media IS EASY. CHECK IT! Medias []struct { Item Item `json:"media"` } `json:"medias"` } `json:"layout_content"` FeedType string `json:"feed_type"` ExploreItemInfo struct { NumColumns int `json:"num_columns"` TotalNumColumns int `json:"total_num_columns"` AspectRatio float32 `json:"aspect_ratio"` Autoplay bool `json:"autoplay"` } `json:"explore_item_info"` } `json:"sections"` MediaCount int `json:"media_count"` ID int64 `json:"id"` MoreAvailable bool `json:"more_available"` NextID string `json:"next_max_id"` NextPage int `json:"next_page"` NextMediaIds []int64 `json:"next_media_ids"` AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"` Status string `json:"status"` // contains filtered or unexported fields }
Hashtag is used for getting the media that matches a hashtag on instagram.
Error returns hashtag error
Next paginates over hashtag pages (xd).
func (h *Hashtag) Stories() (*StoryMedia, error)
Stories returns hashtag stories.
Sync updates Hashtag information preparing it to Next call.
Images are different quality images
GetBest returns the URL of the image with the best quality.
type Inbox struct { Conversations []Conversation `json:"threads"` HasNewer bool `json:"has_newer"` // TODO HasOlder bool `json:"has_older"` Cursor string `json:"oldest_cursor"` UnseenCount int `json:"unseen_count"` UnseenCountTs int64 `json:"unseen_count_ts"` BlendedInboxEnabled bool `json:"blended_inbox_enabled"` // this fields are copied from response SeqID int64 `json:"seq_id"` PendingRequestsTotal int `json:"pending_requests_total"` SnapshotAtMs int64 `json:"snapshot_at_ms"` // contains filtered or unexported fields }
Inbox is the direct message inbox.
Inbox contains Conversations. Each conversation has InboxItems. InboxItems are the message of the chat.
New initialises a new conversation with a user, for further messages you should use Conversation.Send
See example: examples/inbox/newconversation.go
Next allows pagination over messages.
See example: examples/inbox/next.go
NextPending allows pagination over pending messages.
See example: examples/inbox/next.go
Reset sets inbox cursor at the beginning.
Sync updates inbox messages.
See example: examples/inbox/sync.go
SyncPending updates inbox pending messages.
See example: examples/inbox/sync.go
type InboxItem struct { ID string `json:"item_id"` UserID int64 `json:"user_id"` Timestamp int64 `json:"timestamp"` ClientContext string `json:"client_context"` // Type there are a few types: // text, like, raven_media Type string `json:"item_type"` // Text is message text. Text string `json:"text"` Like string `json:"like"` // Media is image or video Media struct { ID string `json:"id"` Images Images `json:"image_versions2"` OriginalWidth int `json:"original_width"` OriginalHeight int `json:"original_height"` MediaType int `json:"media_type"` MediaID int64 `json:"media_id"` PlaybackDurationSecs int `json:"playback_duration_secs"` URLExpireAtSecs int `json:"url_expire_at_secs"` OrganicTrackingToken string `json:"organic_tracking_token"` } }
InboxItem is any conversation message.
type InboxItemLike struct { ItemID string `json:"item_id"` ItemType string `json:"item_type"` Timestamp int64 `json:"timestamp"` UserID int64 `json:"user_id"` }
InboxItemLike is the heart sent during a conversation.
type InboxItemMedia struct { ClientContext string `json:"client_context"` ExpiringMediaActionSummary struct { Count int `json:"count"` Timestamp int64 `json:"timestamp"` Type string `json:"type"` } `json:"expiring_media_action_summary"` ItemID string `json:"item_id"` ItemType string `json:"item_type"` RavenMedia struct { MediaType int64 `json:"media_type"` } `json:"raven_media"` ReplyChainCount int `json:"reply_chain_count"` SeenUserIds []interface{} `json:"seen_user_ids"` Timestamp int64 `json:"timestamp"` UserID int64 `json:"user_id"` ViewMode string `json:"view_mode"` }
InboxItemMedia is inbox media item
type Instagram struct { // Challenge controls security side of account (Like sms verify / It was me) Challenge *Challenge // Profiles is the user interaction Profiles *Profiles // Account stores all personal data of the user and his/her options. Account *Account // Search performs searching of multiple things (users, locations...) Search *Search // Timeline allows to receive timeline media. Timeline *Timeline // Activity are instagram notifications. Activity *Activity // Inbox are instagram message/chat system. Inbox *Inbox // Feed for search over feeds Feed *Feed // User contacts from mobile address book Contacts *Contacts // Location instance Locations *LocationInstance // contains filtered or unexported fields }
Instagram represent the main API handler
Profiles: Represents instragram's user profile. Account: Represents instagram's personal account. Search: Represents instagram's search. Timeline: Represents instagram's timeline. Activity: Represents instagram's user activity. Inbox: Represents instagram's messages. Location: Represents instagram's locations.
See Scheme section in README.md for more information.
We recommend to use Export and Import functions after first Login.
Also you can use SetProxy and UnsetProxy to set and unset proxy. Golang also provides the option to set a proxy using HTTP_PROXY env var.
Import imports instagram configuration
This function does not set proxy automatically. Use SetProxy after this call.
func ImportConfig(config ConfigFile) (*Instagram, error)
ImportConfig imports instagram configuration from a configuration object.
This function does not set proxy automatically. Use SetProxy after this call.
ImportReader imports instagram configuration from io.Reader
This function does not set proxy automatically. Use SetProxy after this call.
New creates Instagram structure
Export exports *Instagram object options
GetMedia returns media specified by id.
See example: examples/media/like.go
Login performs instagram login.
Password will be deleted after login
Logout closes current session
NewHashtag returns initialised hashtag structure Name parameter is hashtag name
NewUser returns prepared user to be used with his functions.
Save exports config to ~/.goinsta
SetCookieJar sets the Cookie Jar. This further allows to use a custom implementation of a cookie jar which may be backed by a different data store such as redis.
SetDeviceID sets device id
SetHTTPClient sets http client. This further allows users to use this functionality for HTTP testing using a mocking HTTP client Transport, which avoids direct calls to the Instagram, instead of returning mocked responses.
func (inst *Instagram) SetHTTPTransport(transport http.RoundTripper)
SetHTTPTransport sets http transport. This further allows users to tweak the underlying low level transport for adding additional fucntionalities.
SetPhoneID sets phone id
SetProxy sets proxy for connection.
SetUUID sets uuid
UnsetProxy unsets proxy for connection.
func (insta *Instagram) UploadAlbum(photos []io.Reader, photoCaption string, quality int, filterType int) (Item, error)
UploadAlbum post image from io.Reader to instagram.
func (insta *Instagram) UploadPhoto(photo io.Reader, photoCaption string, quality int, filterType int) (Item, error)
UploadPhoto post image from io.Reader to instagram.
type Item struct { Comments *Comments `json:"-"` TakenAt int64 `json:"taken_at"` Pk int64 `json:"pk"` ID string `json:"id"` CommentsDisabled bool `json:"comments_disabled"` DeviceTimestamp int64 `json:"device_timestamp"` MediaType int `json:"media_type"` Code string `json:"code"` ClientCacheKey string `json:"client_cache_key"` FilterType int `json:"filter_type"` CarouselParentID string `json:"carousel_parent_id"` CarouselMedia []Item `json:"carousel_media,omitempty"` User User `json:"user"` bool `json:"can_viewer_reshare"` Caption Caption `json:"caption"` CaptionIsEdited bool `json:"caption_is_edited"` Likes int `json:"like_count"` HasLiked bool `json:"has_liked"` // Toplikers can be `string` or `[]string`. // Use TopLikers function instead of getting it directly. Toplikers interface{} `json:"top_likers"` Likers []User `json:"likers"` CommentLikesEnabled bool `json:"comment_likes_enabled"` CommentThreadingEnabled bool `json:"comment_threading_enabled"` HasMoreComments bool `json:"has_more_comments"` MaxNumVisiblePreviewComments int `json:"max_num_visible_preview_comments"` // Previewcomments can be `string` or `[]string` or `[]Comment`. // Use PreviewComments function instead of getting it directly. Previewcomments interface{} `json:"preview_comments,omitempty"` CommentCount int `json:"comment_count"` PhotoOfYou bool `json:"photo_of_you"` // Tags are tagged people in photo Tags struct { In []Tag `json:"in"` } `json:"usertags,omitempty"` FbUserTags Tag `json:"fb_user_tags"` CanViewerSave bool `json:"can_viewer_save"` OrganicTrackingToken string `json:"organic_tracking_token"` // Images contains URL images in different versions. // Version = quality. Images Images `json:"image_versions2,omitempty"` OriginalWidth int `json:"original_width,omitempty"` OriginalHeight int `json:"original_height,omitempty"` ImportedTakenAt int64 `json:"imported_taken_at,omitempty"` Location Location `json:"location,omitempty"` Lat float64 `json:"lat,omitempty"` Lng float64 `json:"lng,omitempty"` // Videos Videos []Video `json:"video_versions,omitempty"` HasAudio bool `json:"has_audio,omitempty"` VideoDuration float64 `json:"video_duration,omitempty"` ViewCount float64 `json:"view_count,omitempty"` IsDashEligible int `json:"is_dash_eligible,omitempty"` VideoDashManifest string `json:"video_dash_manifest,omitempty"` NumberOfQualities int `json:"number_of_qualities,omitempty"` // Only for stories StoryEvents []interface{} `json:"story_events"` []interface{} `json:"story_hashtags"` StoryPolls []interface{} `json:"story_polls"` StoryFeedMedia []interface{} `json:"story_feed_media"` StorySoundOn []interface{} `json:"story_sound_on"` CreativeConfig interface{} `json:"creative_config"` StoryLocations []interface{} `json:"story_locations"` StorySliders []interface{} `json:"story_sliders"` StoryQuestions []interface{} `json:"story_questions"` StoryProductItems []interface{} `json:"story_product_items"` StoryCTA []StoryCTA `json:"story_cta"` ReelMentions []StoryReelMention `json:"reel_mentions"` SupportsReelReactions bool `json:"supports_reel_reactions"` bool `json:"show_one_tap_fb_share_tooltip"` int64 `json:"has_shared_to_fb"` Mentions []Mentions Audience string `json:"audience,omitempty"` StoryMusicStickers []struct { X float64 `json:"x"` Y float64 `json:"y"` Z int `json:"z"` Width float64 `json:"width"` Height float64 `json:"height"` Rotation float64 `json:"rotation"` IsPinned int `json:"is_pinned"` IsHidden int `json:"is_hidden"` IsSticker int `json:"is_sticker"` MusicAssetInfo struct { ID string `json:"id"` Title string `json:"title"` Subtitle string `json:"subtitle"` DisplayArtist string `json:"display_artist"` CoverArtworkURI string `json:"cover_artwork_uri"` CoverArtworkThumbnailURI string `json:"cover_artwork_thumbnail_uri"` ProgressiveDownloadURL string `json:"progressive_download_url"` HighlightStartTimesInMs []int `json:"highlight_start_times_in_ms"` IsExplicit bool `json:"is_explicit"` DashManifest string `json:"dash_manifest"` HasLyrics bool `json:"has_lyrics"` AudioAssetID string `json:"audio_asset_id"` IgArtist struct { Pk int `json:"pk"` Username string `json:"username"` FullName string `json:"full_name"` IsPrivate bool `json:"is_private"` ProfilePicURL string `json:"profile_pic_url"` ProfilePicID string `json:"profile_pic_id"` IsVerified bool `json:"is_verified"` } `json:"ig_artist"` PlaceholderProfilePicURL string `json:"placeholder_profile_pic_url"` ShouldMuteAudio bool `json:"should_mute_audio"` ShouldMuteAudioReason string `json:"should_mute_audio_reason"` OverlapDurationInMs int `json:"overlap_duration_in_ms"` AudioAssetStartTimeInMs int `json:"audio_asset_start_time_in_ms"` } `json:"music_asset_info"` } `json:"story_music_stickers,omitempty"` // contains filtered or unexported fields }
Item represents media items
All Item has Images or Videos objects which contains the url(s). You can use Download function to get the best quality Image or Video from Item.
Delete deletes your media item. StoryMedia or FeedMedia
See example: examples/media/mediaDelete.go
Download downloads media item (video or image) with the best quality.
Input parameters are folder and filename. If filename is "" will be saved with the default value name.
If file exists it will be saved This function makes folder automatically
This function returns an slice of location of downloaded items The returned values are the output path of images and videos.
This function does not download CarouselMedia.
See example: examples/media/itemDownload.go
Hashtags returns caption hashtags.
Item media parent must be FeedMedia.
See example: examples/media/hashtags.go
Like mark media item as liked.
See example: examples/media/like.go
MediaToString returns Item.MediaType as string.
PreviewComments returns string slice or single string (inside Comment slice) Depending on PreviewComments parameter. If PreviewComments are string or []string only the Text field will be filled.
Save saves media item.
You can get saved media using Account.Saved()
StoryIsCloseFriends returns a bool If the returned value is true the story was published only for close friends
SyncLikers fetch new likers of a media
This function updates Item.Likers value
TopLikers returns string slice or single string (inside string slice) Depending on TopLikers parameter.
Unlike mark media item as unliked.
See example: examples/media/unlike.go
type LayoutSection struct { LayoutType string `json:"layout_type"` LayoutContent struct { Medias []struct { Media Item `json:"media"` } `json:"medias"` } `json:"layout_content"` FeedType string `json:"feed_type"` ExploreItemInfo struct { NumColumns int `json:"num_columns"` TotalNumColumns int `json:"total_num_columns"` AspectRatio int `json:"aspect_ratio"` Autoplay bool `json:"autoplay"` } `json:"explore_item_info"` }
type LiveItems struct { ID string `json:"pk"` User User `json:"user"` Broadcasts []Broadcast `json:"broadcasts"` LastSeenBroadcastTs float64 `json:"last_seen_broadcast_ts"` RankedPosition int64 `json:"ranked_position"` SeenRankedPosition int64 `json:"seen_ranked_position"` Muted bool `json:"muted"` CanReply bool `json:"can_reply"` bool `json:"can_reshare"` }
LiveItems are Live media items
type Location struct { Pk int64 `json:"pk"` Name string `json:"name"` Address string `json:"address"` City string `json:"city"` ShortName string `json:"short_name"` Lng float64 `json:"lng"` Lat float64 `json:"lat"` ExternalSource string `json:"external_source"` FacebookPlacesID int64 `json:"facebook_places_id"` }
Location stores media location information.
type LocationInstance struct {
// contains filtered or unexported fields
}
func (l *LocationInstance) Feeds(locationID int64) (*Section, error)
type Media interface { // Next allows pagination Next(...interface{}) bool // Error returns error (in case it have been occurred) Error() error // ID returns media id ID() string // Delete removes media Delete() error // contains filtered or unexported methods }
Media interface defines methods for both StoryMedia and FeedMedia.
type Mentions struct { X float64 `json:"x"` Y float64 `json:"y"` Z int64 `json:"z"` Width float64 `json:"width"` Height float64 `json:"height"` Rotation float64 `json:"rotation"` IsPinned int `json:"is_pinned"` User User `json:"user"` }
Mentions is a user being mentioned on media.
type MineActivity struct { // Ad is every column of Activity section Ad struct { Items []struct { //User User `json:"user"` Algorithm string `json:"algorithm"` SocialContext string `json:"social_context"` Icon string `json:"icon"` Caption string `json:"caption"` MediaIds []interface{} `json:"media_ids"` ThumbnailUrls []interface{} `json:"thumbnail_urls"` LargeUrls []interface{} `json:"large_urls"` MediaInfos []interface{} `json:"media_infos"` Value float64 `json:"value"` IsNewSuggestion bool `json:"is_new_suggestion"` } `json:"items"` MoreAvailable bool `json:"more_available"` } `json:"aymf"` Counts struct { PhotosOfYou int `json:"photos_of_you"` Requests int `json:"requests"` } `json:"counts"` FriendRequestStories []interface{} `json:"friend_request_stories"` Stories []struct { Type int `json:"type"` StoryType int `json:"story_type"` Args struct { Text string `json:"text"` Links []struct { Start int `json:"start"` End int `json:"end"` Type string `json:"type"` ID string `json:"id"` } `json:"links"` InlineFollow struct { UserInfo User `json:"user_info"` Following bool `json:"following"` OutgoingRequest bool `json:"outgoing_request"` } `json:"inline_follow"` Actions []string `json:"actions"` ProfileID int64 `json:"profile_id"` ProfileImage string `json:"profile_image"` Timestamp float64 `json:"timestamp"` Tuuid string `json:"tuuid"` Clicked bool `json:"clicked"` ProfileName string `json:"profile_name"` LatestReelMedia int64 `json:"latest_reel_media"` } `json:"args"` Counts struct { } `json:"counts"` Pk string `json:"pk"` } `json:"old_stories"` ContinuationToken int64 `json:"continuation_token"` Subscription interface{} `json:"subscription"` NextID int64 `json:"next_max_id"` Status string `json:"status"` // contains filtered or unexported fields }
MineActivity is the recent activity menu.
See example: examples/activity/recent.go
func (act *MineActivity) Error() error
func (act *MineActivity) Next() bool
Next function allows pagination over notifications.
See example: examples/activity/recent.go
type Nametag struct { Mode int64 `json:"mode"` Gradient json.Number `json:"gradient,Number"` Emoji string `json:"emoji"` SelfieSticker json.Number `json:"selfie_sticker,Number"` }
Nametag is part of the account information.
type PicURLInfo struct { Height int `json:"height"` URL string `json:"url"` Width int `json:"width"` }
PicURLInfo repre
type Profiles struct {
// contains filtered or unexported fields
}
Profiles allows user function interactions
func (prof *Profiles) Blocked() ([]BlockedUser, error)
Blocked returns a list of blocked profiles.
ByID returns a *User structure parsed by user id
ByName return a *User structure parsed by username
type SavedMedia struct { Items []struct { Media Item `json:"media"` } `json:"items"` NumResults int `json:"num_results"` MoreAvailable bool `json:"more_available"` AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"` Status string `json:"status"` }
SavedMedia stores the information about media being saved before in my account.
type School struct { }
School is void structure (yet).
type Search struct {
// contains filtered or unexported fields
}
Search is the object for all searches like Facebook, Location or Tag search.
func (search *Search) Facebook(user string) (*SearchResult, error)
Facebook search by facebook user.
func (search *Search) Location(lat, lng, location string) (*SearchResult, error)
Location search by location. DEPRECATED - Instagram does not allow Location search method. Lat and Lng (Latitude & Longitude) cannot be ""
func (search *Search) Tags(tag string) (*SearchResult, error)
Tags search by tag
User search by username, you can use count optional parameter to get more than 50 items.
type SearchResult struct { HasMore bool `json:"has_more"` RankToken string `json:"rank_token"` Status string `json:"status"` NumResults int64 `json:"num_results"` // User search results Users []User `json:"users"` // Tag search results Tags []struct { ID int64 `json:"id"` Name string `json:"name"` MediaCount int `json:"media_count"` FollowStatus interface{} `json:"follow_status"` Following interface{} `json:"following"` AllowFollowing interface{} `json:"allow_following"` AllowMutingStory interface{} `json:"allow_muting_story"` ProfilePicURL interface{} `json:"profile_pic_url"` NonViolating interface{} `json:"non_violating"` RelatedTags interface{} `json:"related_tags"` DebugInfo interface{} `json:"debug_info"` } `json:"results"` // Location search result RequestID string `json:"request_id"` Venues []struct { ExternalIDSource string `json:"external_id_source"` ExternalID string `json:"external_id"` Lat float64 `json:"lat"` Lng float64 `json:"lng"` Address string `json:"address"` Name string `json:"name"` } `json:"venues"` // Facebook // Facebook also uses `Users` Places []interface{} `json:"places"` []struct { Position int `json:"position"` Hashtag struct { Name string `json:"name"` ID int64 `json:"id"` MediaCount int `json:"media_count"` } `json:"hashtag"` } `json:"hashtags"` ClearClientCache bool `json:"clear_client_cache"` }
SearchResult handles the data for the results given by each type of Search.
type Section struct { Sections []LayoutSection `json:"sections"` MoreAvailable bool `json:"more_available"` NextPage int `json:"next_page"` NextMediaIds []int64 `json:"next_media_ids"` NextMaxID string `json:"next_max_id"` Status string `json:"status"` }
type StoryCTA struct { Links []struct { LinkType int `json:"linkType"` WebURI string `json:"webUri"` AndroidClass string `json:"androidClass"` Package string `json:"package"` DeeplinkURI string `json:"deeplinkUri"` CallToActionTitle string `json:"callToActionTitle"` RedirectURI interface{} `json:"redirectUri"` LeadGenFormID string `json:"leadGenFormId"` IgUserID string `json:"igUserId"` AppInstallObjectiveInvalidationBehavior interface{} `json:"appInstallObjectiveInvalidationBehavior"` } `json:"links"` }
StoryCTA represent story cta
type StoryMedia struct { Pk interface{} `json:"id"` LatestReelMedia int64 `json:"latest_reel_media"` ExpiringAt float64 `json:"expiring_at"` HaveBeenSeen float64 `json:"seen"` CanReply bool `json:"can_reply"` Title string `json:"title"` bool `json:"can_reshare"` ReelType string `json:"reel_type"` User User `json:"user"` Items []Item `json:"items"` ReelMentions []string `json:"reel_mentions"` PrefetchCount int `json:"prefetch_count"` // this field can be int or bool HasBestiesMedia interface{} `json:"has_besties_media"` StoryRankingToken string `json:"story_ranking_token"` Broadcasts []Broadcast `json:"broadcasts"` FaceFilterNuxVersion int `json:"face_filter_nux_version"` HasNewNuxStory bool `json:"has_new_nux_story"` Status string `json:"status"` // contains filtered or unexported fields }
StoryMedia is the struct that handles the information from the methods to get info about Stories.
func (media *StoryMedia) Delete() error
Delete removes instragram story.
See example: examples/media/deleteStories.go
func (media StoryMedia) Error() error
Error returns error happened any error
func (media *StoryMedia) ID() string
ID returns Story id
func (media *StoryMedia) Next(params ...interface{}) bool
Next allows pagination after calling: User.Stories
returns false when list reach the end if StoryMedia.Error() is ErrNoMore no problem have been occurred.
func (media *StoryMedia) Sync() error
Sync function is used when Highlight must be sync. Highlight must be sync when User.Highlights does not return any object inside StoryMedia slice.
This function does NOT update Stories items.
This function updates StoryMedia.Items
type StoryReelMention struct { X float64 `json:"x"` Y float64 `json:"y"` Z int `json:"z"` Width float64 `json:"width"` Height float64 `json:"height"` Rotation float64 `json:"rotation"` IsPinned int `json:"is_pinned"` IsHidden int `json:"is_hidden"` User User }
StoryReelMention represent story reel mention
type SuggestedUsers struct { Type int `json:"type"` Suggestions []struct { User User `json:"user"` Algorithm string `json:"algorithm"` SocialContext string `json:"social_context"` Icon string `json:"icon"` Caption string `json:"caption"` MediaIds []interface{} `json:"media_ids"` ThumbnailUrls []interface{} `json:"thumbnail_urls"` LargeUrls []interface{} `json:"large_urls"` MediaInfos []interface{} `json:"media_infos"` Value float64 `json:"value"` IsNewSuggestion bool `json:"is_new_suggestion"` } `json:"suggestions"` LandingSiteType string `json:"landing_site_type"` Title string `json:"title"` ViewAllText string `json:"view_all_text"` LandingSiteTitle string `json:"landing_site_title"` NetegoType string `json:"netego_type"` UpsellFbPos string `json:"upsell_fb_pos"` AutoDvance string `json:"auto_dvance"` ID string `json:"id"` TrackingToken string `json:"tracking_token"` }
SuggestedUsers stores the information about user suggestions.
type SyncAnswer struct { Users []struct { Pk int64 `json:"pk"` Username string `json:"username"` FullName string `json:"full_name"` IsPrivate bool `json:"is_private"` ProfilePicURL string `json:"profile_pic_url"` ProfilePicID string `json:"profile_pic_id"` IsVerified bool `json:"is_verified"` HasAnonymousProfilePicture bool `json:"has_anonymous_profile_picture"` ReelAutoArchive string `json:"reel_auto_archive"` AddressbookName string `json:"addressbook_name"` } `json:"users"` Warning string `json:"warning"` Status string `json:"status"` }
type Tag struct { In []struct { User User `json:"user"` Position []float64 `json:"position"` StartTimeInVideoInSec interface{} `json:"start_time_in_video_in_sec"` DurationInVideoInSec interface{} `json:"duration_in_video_in_sec"` } `json:"in"` }
Tag is the information of an user being tagged on any media.
type Timeline struct {
// contains filtered or unexported fields
}
Timeline is the object to represent the main feed on instagram, the first page that shows the latest feeds of my following contacts.
Get returns latest media from timeline.
For pagination use FeedMedia.Next()
Stories returns slice of StoryMedia
type Tray struct { Stories []StoryMedia `json:"tray"` Lives struct { LiveItems []LiveItems `json:"post_live_items"` } `json:"post_live"` StoryRankingToken string `json:"story_ranking_token"` Broadcasts []Broadcast `json:"broadcasts"` FaceFilterNuxVersion int `json:"face_filter_nux_version"` HasNewNuxStory bool `json:"has_new_nux_story"` Status string `json:"status"` }
Tray is a set of story media received from timeline calls.
type User struct { ID int64 `json:"pk"` Username string `json:"username"` FullName string `json:"full_name"` Biography string `json:"biography"` ProfilePicURL string `json:"profile_pic_url"` Email string `json:"email"` PhoneNumber string `json:"phone_number"` IsBusiness bool `json:"is_business"` Gender int `json:"gender"` ProfilePicID string `json:"profile_pic_id"` HasAnonymousProfilePicture bool `json:"has_anonymous_profile_picture"` IsPrivate bool `json:"is_private"` IsUnpublished bool `json:"is_unpublished"` AllowedCommenterType string `json:"allowed_commenter_type"` IsVerified bool `json:"is_verified"` MediaCount int `json:"media_count"` FollowerCount int `json:"follower_count"` FollowingCount int `json:"following_count"` FollowingTagCount int `json:"following_tag_count"` MutualFollowersID []int64 `json:"profile_context_mutual_follow_ids"` ProfileContext string `json:"profile_context"` GeoMediaCount int `json:"geo_media_count"` ExternalURL string `json:"external_url"` HasBiographyTranslation bool `json:"has_biography_translation"` ExternalLynxURL string `json:"external_lynx_url"` BiographyWithEntities struct { RawText string `json:"raw_text"` Entities []interface{} `json:"entities"` } `json:"biography_with_entities"` int `json:"usertags_count"` HasChaining bool `json:"has_chaining"` IsFavorite bool `json:"is_favorite"` IsFavoriteForStories bool `json:"is_favorite_for_stories"` IsFavoriteForHighlights bool `json:"is_favorite_for_highlights"` CanBeReportedAsFraud bool `json:"can_be_reported_as_fraud"` ShowShoppableFeed bool `json:"show_shoppable_feed"` ShoppablePostsCount int `json:"shoppable_posts_count"` ReelAutoArchive string `json:"reel_auto_archive"` HasHighlightReels bool `json:"has_highlight_reels"` PublicEmail string `json:"public_email"` PublicPhoneNumber string `json:"public_phone_number"` PublicPhoneCountryCode string `json:"public_phone_country_code"` ContactPhoneNumber string `json:"contact_phone_number"` CityID int64 `json:"city_id"` CityName string `json:"city_name"` AddressStreet string `json:"address_street"` DirectMessaging string `json:"direct_messaging"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Category string `json:"category"` BusinessContactMethod string `json:"business_contact_method"` IncludeDirectBlacklistStatus bool `json:"include_direct_blacklist_status"` HdProfilePicURLInfo PicURLInfo `json:"hd_profile_pic_url_info"` HdProfilePicVersions []PicURLInfo `json:"hd_profile_pic_versions"` School School `json:"school"` Byline string `json:"byline"` SocialContext string `json:"social_context,omitempty"` SearchSocialContext string `json:"search_social_context,omitempty"` MutualFollowersCount float64 `json:"mutual_followers_count"` LatestReelMedia int64 `json:"latest_reel_media,omitempty"` IsCallToActionEnabled bool `json:"is_call_to_action_enabled"` FbPageCallToActionID string `json:"fb_page_call_to_action_id"` Zip string `json:"zip"` Friendship Friendship `json:"friendship_status"` // contains filtered or unexported fields }
User is the representation of instagram's user profile
Block blocks user
This function updates current User.Friendship structure.
See example: examples/user/block.go
Feed returns user feeds (media)
params can be: string: timestamp of the minimum media timestamp.
For pagination use FeedMedia.Next()
See example: examples/user/feed.go
Follow started following some user
This function performs a follow call. If user is private you have to wait until he/she accepts you.
See example: examples/user/follow.go
Followers returns a list of user followers.
See example: examples/user/followers.go
Following returns a list of user following.
See example: examples/user/following.go
FriendShip allows user to get friend relationship.
The result is stored in user.Friendship
func (user *User) Highlights() ([]StoryMedia, error)
Highlights represents saved stories.
See example: examples/user/highlights.go
Mute mutes user from appearing in the feed or story reel
Use one of the pre-defined constants to choose what exactly to mute: goinsta.MuteAll, goinsta.MuteStory, goinsta.MuteFeed This function updates current User.Friendship structure.
SetInstagram will update instagram instance for selected User.
func (user *User) Stories() *StoryMedia
Stories returns user stories
Use StoryMedia.Next for pagination.
See example: examples/user/stories.go
Sync updates user info
params can be: bool: must be true if you want to include FriendShip call. See goinsta.FriendShip
See example: examples/user/friendship.go
Tags returns media where user is tagged in
For pagination use FeedMedia.Next()
See example: examples/user/tags.go
Unblock unblocks user
This function updates current User.Friendship structure.
See example: examples/user/unblock.go
Unfollow unfollows user
See example: examples/user/unfollow.go
Unmute unmutes user so it appears in the feed or story reel again
Use one of the pre-defined constants to choose what exactly to unmute: goinsta.MuteAll, goinsta.MuteStory, goinsta.MuteFeed This function updates current User.Friendship structure.
type Users struct { Status string `json:"status"` BigList bool `json:"big_list"` Users []User `json:"users"` PageSize int `json:"page_size"` NextID string `json:"next_max_id"` // contains filtered or unexported fields }
Users is a struct that stores many user's returned by many different methods.
Error returns users error
Next allows to paginate after calling: Account.Follow* and User.Follow*
returns false when list reach the end.
SetInstagram sets new instagram to user structure
type Video struct { Type int `json:"type"` Width int `json:"width"` Height int `json:"height"` URL string `json:"url"` ID string `json:"id"` }
Video are different quality videos
Path | Synopsis |
---|---|
utilities |
Package goinsta imports 28 packages (graph) and is imported by 35 packages. Updated 2019-12-04. Refresh now. Tools for package owners.