goinsta

package module
v2.4.6-0...-b0ff579 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 35 Imported by: 0

README

Golang + Instagram Private API

Unofficial Instagram API for Golang

Build Status GoDoc Go Report Card Gitter chat

Features

  • HTTP2 by default. Goinsta uses HTTP2 client enhancing performance.
  • Object independency. Can handle multiple instagram accounts.
  • Like Instagram mobile application. Goinsta is very similar to Instagram official application.
  • Simple. Goinsta is made by lazy programmers!
  • Backup methods. You can use Export and Import functions.
  • Security. Your password is only required to login. After login your password is deleted.
  • No External Dependencies. GoInsta will not use any Go packages outside of the standard library.

Package installation

go get -u -v gopkg.in/Davincible/goinsta.v2

Example

package main

import (
	"fmt"

	"gopkg.in/Davincible/goinsta.v2"
)

func main() {  
  insta := goinsta.New("USERNAME", "PASSWORD")

  // Export your configuration
  // after exporting you can use Import function instead of New function.
  // insta, err := goinsta.Import("~/.goinsta")
  // it's useful when you want use goinsta repeatedly.
  insta.Export("~/.goinsta")

  ...
}

Projects using goinsta

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.

Versioning

Goinsta used gopkg.in as versioning control. Stable new API is the version v2.0. You can get it using:

$ go get -u -v gopkg.in/Davincible/goinsta.v2

Or

If you have GO111MODULE=on

$ go get -u github.com/Davincible/goinsta/v2

Donate

Davincible

btc Bitcoin: 1KjcfrBPJtM4MfBSGTqpC6RcoEW1KBh15X

Mester

btc Bitcoin: 37aogDJYBFkdSJTWG7TgcpgNweGHPCy1Ks

Analytics

Documentation

Index

Constants

View Source
const (
	MuteAll   muteOption = "all"
	MuteStory muteOption = "story"
	MuteFeed  muteOption = "feed"
)

Variables

View Source
var ErrNoMore = errors.New("List end have been reached")

ErrNoMore is an error that comes when there is no more elements available on the list.

Functions

func AESGCMEncrypt

func AESGCMEncrypt(key, data, additionalData []byte) (iv, encrypted, tag []byte, err error)

func EncryptPassword

func EncryptPassword(password, pubKeyEncoded string, pubKeyVersion int, t string) (string, error)

func Export

func Export(insta *Instagram, writer io.Writer) error

Export exports selected *Instagram object options to an io.Writer

func GetBest

func GetBest(obj interface{}) string

GetBest returns best quality image or video.

Arguments can be []Video or []Candidate

func Jazoest

func Jazoest(str string) string

func MediaIDFromShortID

func MediaIDFromShortID(code string) (string, error)

func RSADecodePublicKeyFromBase64

func RSADecodePublicKeyFromBase64(pubKeyBase64 string) (*rsa.PublicKey, error)

func RSAPublicKeyPKCS1Encrypt

func RSAPublicKeyPKCS1Encrypt(publicKey *rsa.PublicKey, data []byte) ([]byte, error)

Types

type Account

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"`
	UsertagsCount              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/*

func (*Account) Archived

func (account *Account) Archived(params ...interface{}) *FeedMedia

Archived returns current account archive feed

For pagination use FeedMedia.Next()

func (*Account) ChangePassword

func (account *Account) ChangePassword(old, new string) error

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

func (*Account) ChangeProfilePic

func (account *Account) ChangeProfilePic(photo io.Reader) error

ChangeProfilePic Update profile picture

See example: examples/account/change-profile-pic/main.go

func (*Account) Feed

func (account *Account) Feed(params ...interface{}) *FeedMedia

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()

func (*Account) Followers

func (account *Account) Followers() *Users

Followers returns a list of user followers.

Users.Next can be used to paginate

See example: examples/account/followers.go

func (*Account) Following

func (account *Account) Following() *Users

Following returns a list of user following.

Users.Next can be used to paginate

See example: examples/account/following.go

func (*Account) Liked

func (account *Account) Liked() *FeedMedia

Liked are liked publications

func (*Account) PendingFollowRequests

func (account *Account) PendingFollowRequests() ([]User, error)

PendingFollowRequests returns pending follow requests.

func (*Account) RemoveProfilePic

func (account *Account) RemoveProfilePic() error

RemoveProfilePic removes current profile picture

This function updates current Account information.

See example: examples/account/removeProfilePic.go

func (*Account) Saved

func (account *Account) Saved() *SavedMedia

Saved returns saved media. To get all the media you have to use the Next() method.

func (*Account) SetBiography

func (account *Account) SetBiography(bio string) error

SetBiography changes your Instagram's biography.

This function updates current Account information.

func (*Account) SetPrivate

func (account *Account) SetPrivate() error

SetPrivate sets account to private mode.

This function updates current Account information.

See example: examples/account/setPrivate.go

func (*Account) SetPublic

func (account *Account) SetPublic() error

SetPublic sets account to public mode.

This function updates current Account information.

See example: examples/account/setPublic.go

func (*Account) Stories

func (account *Account) Stories() *StoryMedia

Stories returns account stories.

Use StoryMedia.Next for pagination.

See example: examples/account/stories.go

func (*Account) Sync

func (account *Account) Sync() error

Sync updates account information

func (*Account) Tags

func (account *Account) Tags(minTimestamp []byte) (*FeedMedia, error)

Tags returns media where account is tagged in

For pagination use FeedMedia.Next()

func (*Account) UpdateProfile

func (account *Account) UpdateProfile(
	editProfileForm map[string]interface{},
) error

UpdateProfile This function updates current Account information.

type Activity

type Activity 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 {
		Campaign      int `json:"campaign_notification"`
		CommentLikes  int `json:"comment_likes"`
		Comments      int `json:"comments"`
		Fundraiser    int `json:"fundraiser"`
		Likes         int `json:"likes"`
		NewPosts      int `json:"new_posts"`
		PhotosOfYou   int `json:"photos_of_you"`
		Relationships int `json:"relationships"`
		Requests      int `json:"requests"`
		Shopping      int `json:"shopping_notification"`
		UserTags      int `json:"usertags"`
	} `json:"counts"`
	FriendRequestStories []interface{} `json:"friend_request_stories"`
	NewStories           []RecentItems `json:"new_stories"`
	OldStories           []RecentItems `json:"old_stories"`
	ContinuationToken    int64         `json:"continuation_token"`
	Subscription         interface{}   `json:"subscription"`
	NextID               string        `json:"next_max_id"`
	LastChecked          float64       `json:"last_checked"`
	FirstRecTs           float64       `json:"pagination_first_record_timestamp"`

	Status string `json:"status"`
	// contains filtered or unexported fields
}

Activity is the recent activity menu.

See example: examples/activity/recent.go

func (*Activity) Error

func (act *Activity) Error() error

func (*Activity) Next

func (act *Activity) Next() bool

Next function allows pagination over notifications.

See example: examples/activity/recent.go

type BlockedUser

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 (*BlockedUser) Unblock

func (b *BlockedUser) Unblock() error

Unblock unblocks blocked user.

type Broadcast

type Broadcast struct {
	LastLikeTs         int64
	LastCommentTs      int64
	LastCommentFetchTs int64
	LastCommentTotal   int

	ID                         int64   `json:"id"`
	MediaID                    string  `json:"media_id"`
	LivePostID                 int64   `json:"live_post_id"`
	BroadcastStatus            string  `json:"broadcast_status"`
	DashPlaybackUrl            string  `json:"dash_playback_url"`
	DashAbrPlaybackUrl         string  `json:"dash_abr_playback_url"`
	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"`
	BroadcastMessage           string  `json:"broadcast_message"`
	OrganicTrackingToken       string  `json:"organic_tracking_token"`
	IsPlayerLiveTrace          int     `json:"is_player_live_trace_enabled"`
	IsGamingContent            int     `json:"is_gaming_content"`
	IsViewerCommentAllowed     bool    `json:"is_viewer_comment_allowed"`
	LiveCommentMentionEnabled  bool    `json:"is_live_comment_mention_enabled"`
	LiveCommmentRepliesEnabled bool    `json:"is_live_comment_replies_enabled"`
	HideFromFeedUnit           bool    `json:"hide_from_feed_unit"`
	VideoDuration              float64 `json:"video_duration"`
	Visibility                 int     `json:"visibility"`
	ResponseTs                 int64   `json:"response_timestamp"`
	Status                     string  `json:"status"`
	Dimensions                 struct {
		Width  int `json:"width"`
		Height int `json:"height"`
	} `json:"dimensions"`
	Experiments map[string]interface{} `json:"broadcast_experiments"`
	// contains filtered or unexported fields
}

Broadcast is live videos.

func (*Broadcast) GetComments

func (br *Broadcast) GetComments() (*BroadcastComments, error)

Call every 2 seconds

func (*Broadcast) GetHeartbeat

func (br *Broadcast) GetHeartbeat() (*BroadcastHeartbeat, error)

Call every 3 seconds

func (*Broadcast) GetInfo

func (br *Broadcast) GetInfo() error

func (*Broadcast) GetLikes

func (br *Broadcast) GetLikes() (*BroadcastLikes, error)

Call every 6 seconds

type BroadcastComments

type BroadcastComments struct {
	CommentLikes               bool       `json:"comment_likes_enabled"`
	Comments                   []struct{} `json:"comments"`
	CommentCount               int        `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"`
	MediaHeaderDisplay         string     `json:"media_header_display"`
	CanViewMorePreviewComments bool       `json:"can_view_more_preview_comments"`
	LiveSecondsPerComment      int        `json:"live_seconds_per_comment"`
	IsFirstFetch               string     `json:"is_first_fetch"`
	SystemComments             []Comment  `json:"system_comments"`
	CommentMuted               int        `json:"comment_muted"`
	IsViewerCommentAllowed     bool       `json:"is_viewer_comment_allowed"`
	Status                     string     `json:"status"`
}

type BroadcastHeartbeat

type BroadcastHeartbeat struct {
	ViewerCount             float64 `json:"viewer_count"`
	BroadcastStatus         string  `json:"broadcast_status"`
	CobroadcasterIds        []int64 `json:"cobroadcaster_ids"`
	OffsetVideoStart        float64 `json:"offset_to_video_start"`
	RequestToJoinEnabled    int     `json:"request_to_join_enabled"`
	UserPayMaxAmountReached bool    `json:"user_pay_max_amount_reached"`
	Status                  string  `json:"status"`
}

type BroadcastLikes

type BroadcastLikes struct {
	Likes      int    `json:"likes"`
	BurstLikes int    `json:"burst_likes"`
	Likers     []User `json:"likers"`
	LikeTs     int64  `json:"like_ts"`
	Status     string `json:"status"`
}

type Candidate

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

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

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
}

func (*Challenge) Process

func (challenge *Challenge) Process(apiURL string) error

func (*Challenge) SendSecurityCode

func (challenge *Challenge) SendSecurityCode(code string) error

sendSecurityCode sends the code received in the message

type ChallengeError

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 (ChallengeError) Error

func (e ChallengeError) Error() string

type ChallengeStepData

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

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

func (*Comment) Like

func (c *Comment) Like() error

Like likes comment.

func (*Comment) Unlike

func (c *Comment) Unlike() error

Unlike unlikes comment.

type Comments

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.

func (*Comments) Add

func (comments *Comments) Add(text string) (err error)

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

func (*Comments) Del

func (comments *Comments) Del(comment *Comment) error

Del deletes comment.

func (*Comments) DelByID

func (comments *Comments) DelByID(id string) error

DelByID removes comment using id.

See example: examples/media/commentsDelByID.go

func (*Comments) DelMine

func (comments *Comments) DelMine(limit int) error

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

func (*Comments) Disable

func (comments *Comments) Disable() error

Disable disables comments in FeedMedia.

See example: examples/media/commentDisable.go

func (*Comments) Enable

func (comments *Comments) Enable() error

Enable enables comments in FeedMedia

See example: examples/media/commentEnable.go

func (Comments) Error

func (comments Comments) Error() error

func (*Comments) Next

func (comments *Comments) Next() bool

Next allows comment pagination.

This function support concurrency methods to get comments using Last and Next ID

New comments are stored in Comments.Items

func (*Comments) Sync

func (comments *Comments) Sync()

Sync prepare Comments to receive comments. Use Next to receive comments.

See example: examples/media/commentsSync.go

type ConfigFile

type ConfigFile struct {
	ID            int64             `json:"id"`
	User          string            `json:"username"`
	DeviceID      string            `json:"device_id"`
	FamilyID      string            `json:"family_id"`
	UUID          string            `json:"uuid"`
	RankToken     string            `json:"rank_token"`
	Token         string            `json:"token"`
	PhoneID       string            `json:"phone_id"`
	XmidExpiry    int64             `json:"xmid_expiry"`
	HeaderOptions map[string]string `json:"header_options"`
	Cookies       []*http.Cookie    `json:"cookies"`
}

ConfigFile is a structure to store the session information so that can be exported or imported.

type Contact

type Contact struct {
	Numbers []string `json:"phone_numbers"`
	Emails  []string `json:"email_addresses"`
	Name    string   `json:"first_name"`
}

type Contacts

type Contacts struct {
	// contains filtered or unexported fields
}

func (*Contacts) SyncContacts

func (c *Contacts) SyncContacts(contacts *[]Contact) (*SyncAnswer, error)

func (*Contacts) UnlinkContacts

func (c *Contacts) UnlinkContacts() error

type Conversation

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"`
	ReshareReceiveCount       int         `json:"reshare_receive_count"`
	ReshareSendCount          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 (Conversation) Error

func (c Conversation) Error() error

func (*Conversation) Like

func (c *Conversation) Like() error

Like sends heart to the conversation

See example: examples/media/likeAll.go

func (*Conversation) Next

func (c *Conversation) Next() bool

Next loads next set of private messages.

See example: examples/inbox/conversation.go

func (*Conversation) Send

func (c *Conversation) Send(text string) error

Send sends message in conversation

See example: examples/inbox/sms.go

func (*Conversation) Write

func (c *Conversation) Write(b []byte) (int, error)

Write is like Send but being compatible with io.Writer.

type Cooldowns

type Cooldowns struct {
	Default int    `json:"default"`
	Global  int    `json:"global"`
	Status  string `json:"status"`
	TTL     int    `json:"ttl"`
	Slots   []struct {
		Cooldown int    `json:"cooldown"`
		Slot     string `json:"slot"`
	} `json:"slots"`
	Surfaces []struct {
		Cooldown int    `json:"cooldown"`
		Slot     string `json:"slot"`
	} `json:"surfaces"`
}

type ErrChallengeProcess

type ErrChallengeProcess struct {
	StepName string
}

func (ErrChallengeProcess) Error

func (ec ErrChallengeProcess) Error() string

type Error400

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.

func (Error400) Error

func (e Error400) Error() string

type Error503

type Error503 struct {
	Message string
}

Error503 is instagram API error

func (Error503) Error

func (e Error503) Error() string

type ErrorN

type ErrorN struct {
	Message   string `json:"message"`
	Status    string `json:"status"`
	ErrorType string `json:"error_type"`
}

ErrorN is general instagram error

func (ErrorN) Error

func (e ErrorN) Error() string

type Feed

type Feed struct {
	// contains filtered or unexported fields
}

Feed is the object for all feed endpoints.

func (*Feed) LocationID

func (feed *Feed) LocationID(locationID int64) (*FeedLocation, error)

Feed search by locationID

func (*Feed) Tags

func (feed *Feed) Tags(tag string) (*FeedTag, error)

Tags search by Tag in user Feed

(sorry for returning FeedTag. See #FeedTag)

type FeedCache

type FeedCache struct {
	Items []struct {
		Media_or_ad Item `json:"media_or_ad"`
		EndOfFeed   struct {
			Pause    bool   `json:"pause"`
			Title    string `json:"title"`
			Subtitle string `json:"subtitle"`
		} `json:"end_of_feed_demarcator"`
	} `json:"feed_items"`

	More_available                 bool    `json:"more_available"`
	NextID                         string  `json:"next_max_id"`
	Num_results                    float64 `json:"num_results"`
	Pull_to_refresh_window_ms      float64 `json:"pull_to_refresh_window_ms"`
	Request_id                     string  `json:"request_id"`
	Session_id                     string  `json:"session_id"`
	View_state_version             string  `json:"view_state_version"`
	Auto_load_more_enabled         bool    `json:"auto_load_more_enabled"`
	Is_direct_v2_enabled           bool    `json:"is_direct_v2_enabled"`
	Client_feed_changelist_applied bool    `json:"client_feed_changelist_applied"`
	Preload_distance               float64 `json:"preload_distance"`
	Status                         string  `json:"status"`
	Feed_pill_text                 string  `json:"feed_pill_text"`
	Startup_prefetch_configs       struct {
		Explore struct {
			Containermodule            string `json:"containermodule"`
			Should_prefetch            bool   `json:"should_prefetch"`
			Should_prefetch_thumbnails bool   `json:"should_prefetch_thumbnails"`
		} `json:"explore"`
	} `json:"startup_prefetch_configs"`
	Use_aggressive_first_tail_load bool    `json:"use_aggressive_first_tail_load"`
	Hide_like_and_view_counts      float64 `json:"hide_like_and_view_counts"`
}

type FeedLocation

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

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

func (*FeedMedia) Delete

func (media *FeedMedia) Delete() error

Delete deletes all items in media. Take care...

See example: examples/media/mediaDelete.go

func (FeedMedia) Error

func (media FeedMedia) Error() error

func (*FeedMedia) ID

func (media *FeedMedia) ID() string

ID returns media id.

func (*FeedMedia) Next

func (media *FeedMedia) Next(params ...interface{}) bool

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.

func (*FeedMedia) SetID

func (media *FeedMedia) SetID(id interface{})

SetID sets media ID this value can be int64 or string

func (*FeedMedia) SetInstagram

func (media *FeedMedia) SetInstagram(insta *Instagram)

SetInstagram set instagram

func (*FeedMedia) Sync

func (media *FeedMedia) Sync() error

Sync updates media values.

type FeedTag

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.

func (*FeedTag) Error

func (ft *FeedTag) Error() error

Error returns hashtag error

func (*FeedTag) Next

func (ft *FeedTag) Next() bool

Next paginates over hashtag feed.

type Friendship

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

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.

func (*Hashtag) Error

func (h *Hashtag) Error() error

Error returns hashtag error

func (*Hashtag) Next

func (h *Hashtag) Next() bool

Next paginates over hashtag pages (xd).

func (*Hashtag) Stories

func (h *Hashtag) Stories() (*StoryMedia, error)

Stories returns hashtag stories.

func (*Hashtag) Sync

func (h *Hashtag) Sync() error

Sync updates Hashtag information preparing it to Next call.

type Images

type Images struct {
	Versions []Candidate `json:"candidates"`
}

Images are different quality images

func (Images) GetBest

func (img Images) GetBest() string

GetBest returns the URL of the image with the best quality.

type Inbox

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"`
	MostRecentInviter   User   `json:"most_recent_inviter"`
	BlendedInboxEnabled bool   `json:"blended_inbox_enabled"`
	NextCursor          struct {
		CursorV2ID         float64 `json:"cursor_thread_v2_id"`
		CursorTimestampSec float64 `json:"cursor_timestamp_seconds"`
	} `json:"next_cursor"`
	PrevCursor struct {
		CursorV2ID         float64 `json:"cursor_thread_v2_id"`
		CursorTimestampSec float64 `json:"cursor_timestamp_seconds"`
	} `json:"prev_cursor"`
	// 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.

func (*Inbox) New

func (inbox *Inbox) New(user *User, text string) error

New initialises a new conversation with a user, for further messages you should use Conversation.Send

See example: examples/inbox/newconversation.go

func (*Inbox) Next

func (inbox *Inbox) Next() bool

Next allows pagination over messages.

See example: examples/inbox/next.go

func (*Inbox) NextPending

func (inbox *Inbox) NextPending() bool

NextPending allows pagination over pending messages.

See example: examples/inbox/next.go

func (*Inbox) Reset

func (inbox *Inbox) Reset()

Reset sets inbox cursor at the beginning.

func (*Inbox) Sync

func (inbox *Inbox) Sync() error

Sync updates inbox messages.

See example: examples/inbox/sync.go

func (*Inbox) SyncPending

func (inbox *Inbox) SyncPending() error

SyncPending updates inbox pending messages.

See example: examples/inbox/sync.go

type InboxItem

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                   int64  `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

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

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

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.

func Import

func Import(path string) (*Instagram, error)

Import imports instagram configuration

This function does not set proxy automatically. Use SetProxy after this call.

func ImportConfig

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.

func ImportReader

func ImportReader(r io.Reader) (*Instagram, error)

ImportReader imports instagram configuration from io.Reader

This function does not set proxy automatically. Use SetProxy after this call.

func New

func New(username, password string) *Instagram

New creates Instagram structure

func (*Instagram) Export

func (insta *Instagram) Export(path string) error

Export exports *Instagram object options

func (*Instagram) GetMedia

func (insta *Instagram) GetMedia(o interface{}) (*FeedMedia, error)

GetMedia returns media specified by id.

The argument can be int64 or string

See example: examples/media/like.go

func (*Instagram) Login

func (insta *Instagram) Login() (err error)

Login performs instagram login sequence in close resemblance to the android apk.

Password will be deleted after login

func (*Instagram) Logout

func (insta *Instagram) Logout() error

Logout closes current session

func (*Instagram) NewHashtag

func (insta *Instagram) NewHashtag(name string) *Hashtag

NewHashtag returns initialised hashtag structure Name parameter is hashtag name

func (*Instagram) NewUser

func (insta *Instagram) NewUser() *User

NewUser returns prepared user to be used with his functions.

func (*Instagram) Save

func (insta *Instagram) Save() error

Save exports config to ~/.goinsta

func (*Instagram) SetCookieJar

func (insta *Instagram) SetCookieJar(jar http.CookieJar) error

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.

func (*Instagram) SetDeviceID

func (insta *Instagram) SetDeviceID(id string)

SetDeviceID sets device id

func (*Instagram) SetHTTPClient

func (insta *Instagram) SetHTTPClient(client *http.Client)

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 (*Instagram) SetHTTPTransport

func (insta *Instagram) SetHTTPTransport(transport http.RoundTripper)

SetHTTPTransport sets http transport. This further allows users to tweak the underlying low level transport for adding additional fucntionalities.

func (*Instagram) SetPhoneID

func (insta *Instagram) SetPhoneID(id string)

SetPhoneID sets phone id

func (*Instagram) SetProxy

func (insta *Instagram) SetProxy(url string, insecure bool, forceHTTP2 bool) error

SetProxy sets proxy for connection.

func (*Instagram) SetUUID

func (insta *Instagram) SetUUID(uuid string)

SetUUID sets uuid

func (*Instagram) UnsetProxy

func (insta *Instagram) UnsetProxy()

UnsetProxy unsets proxy for connection.

func (*Instagram) UploadAlbum

func (insta *Instagram) UploadAlbum(
	photos []io.Reader,
	photoCaption string,
	quality int,
	filterType int,
) (Item, error)

UploadAlbum post image from io.Reader to instagram.

func (*Instagram) UploadPhoto

func (insta *Instagram) UploadPhoto(photo io.Reader, photoCaption string, quality int, filterType int) (Item, error)

UploadPhoto post image from io.Reader to instagram.

func (*Instagram) UploadVideo

func (insta *Instagram) UploadVideo(video io.Reader, title string, caption string, thumbnail io.Reader) (Item, error)

UploadVideo post video and thumbnail from io.Reader to instagram.

type Item

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"`
	FacepileTopLikers []struct {
		FollowFrictionType float64 `json:"follow_friction_type"`
		FullNeme           string  `json:"ful_name"`
		IsPrivate          bool    `json:"is_private"`
		IsVerified         bool    `json:"is_verified"`
		Pk                 float64 `json:"pk"`
		ProfilePicID       string  `json:"profile_pic_id"`
		ProfilePicURL      string  `json:"profile_pic_url"`
		Username           string  `json:"username"`
	} `json:"facepile_top_likers"`
	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"`
	CanViewerReshare      bool    `json:"can_viewer_reshare"`
	Caption               Caption `json:"caption"`
	CaptionIsEdited       bool    `json:"caption_is_edited"`
	LikeViewCountDisabled bool    `json:"like_and_view_counts_disabled"`
	IsCommercial          bool    `json:"is_commercial"`
	CommercialityStatus   string  `json:"commerciality_status"`
	FundraiserTag         struct {
		HasStandaloneFundraiser bool `json:"has_standalone_fundraiser"`
	} `json:"fundraiser_tag"`
	IsPaidPartnership bool   `json:"is_paid_partnership"`
	ProductType       string `json:"product_type"`
	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"`
	VideoCodec        string  `json:"video_codec"`
	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"`
	IsUnifiedVideo    bool    `json:"is_unified_video"`
	VideoDashManifest string  `json:"video_dash_manifest,omitempty"`
	NumberOfQualities int     `json:"number_of_qualities,omitempty"`

	// Only for stories
	StoryEvents              []interface{}      `json:"story_events"`
	StoryHashtags            []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"`
	IntegrityReviewDecision  string             `json:"integrity_review_decision"`
	IsReelMedia              bool               `json:"is_reel_media"`
	ProfileGridControl       bool               `json:"profile_grid_control_enabled"`
	ReelMentions             []StoryReelMention `json:"reel_mentions"`
	ExpiringAt               int64              `json:"expiring_at"`
	CanSendCustomEmojis      bool               `json:"can_send_custom_emojis"`
	SupportsReelReactions    bool               `json:"supports_reel_reactions"`
	ShowOneTapFbShareTooltip bool               `json:"show_one_tap_fb_share_tooltip"`
	HasSharedToFb            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.

func (*Item) Comment

func (item *Item) Comment(text string) error

Comment pushes a text comment to media item.

If parent media is a Story this function will send a private message replying the Instagram story.

func (*Item) Delete

func (item *Item) Delete() error

Delete deletes your media item. StoryMedia or FeedMedia

See example: examples/media/mediaDelete.go

func (*Item) Download

func (item *Item) Download(folder, name string) (imgs, vds string, err error)

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

func (*Item) Hashtags

func (item *Item) Hashtags() []Hashtag

Hashtags returns caption hashtags.

Item media parent must be FeedMedia.

See example: examples/media/hashtags.go

func (*Item) Like

func (item *Item) Like() error

Like mark media item as liked.

See example: examples/media/like.go

func (*Item) MediaToString

func (item *Item) MediaToString() string

MediaToString returns Item.MediaType as string.

func (*Item) PreviewComments

func (item *Item) PreviewComments() []Comment

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.

func (*Item) Save

func (item *Item) Save() error

Save saves media item.

You can get saved media using Account.Saved()

func (*Item) StoryIsCloseFriends

func (item *Item) StoryIsCloseFriends() bool

StoryIsCloseFriends returns a bool If the returned value is true the story was published only for close friends

func (*Item) SyncLikers

func (item *Item) SyncLikers() error

SyncLikers fetch new likers of a media

This function updates Item.Likers value

func (*Item) TopLikers

func (item *Item) TopLikers() []string

TopLikers returns string slice or single string (inside string slice) Depending on TopLikers parameter.

func (*Item) Unlike

func (item *Item) Unlike() error

Unlike mark media item as unliked.

See example: examples/media/unlike.go

func (*Item) Unsave

func (item *Item) Unsave() error

Unsave unsaves media item.

type LayoutSection

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

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"`
	CanReshare          bool        `json:"can_reshare"`
}

LiveItems are Live media items

type Location

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

type LocationInstance struct {
	// contains filtered or unexported fields
}

func (*LocationInstance) Feeds

func (l *LocationInstance) Feeds(locationID int64) (*Section, error)

type Media

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 MediaItem

type MediaItem struct {
	Media Item `json:"media"`
}

MediaItem defines a item media for the SavedMedia struct

type Mentions

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 Nametag

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

type PicURLInfo struct {
	Height int    `json:"height"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
}

PicURLInfo repre

type Profiles

type Profiles struct {
	// contains filtered or unexported fields
}

Profiles allows user function interactions

func (*Profiles) Blocked

func (prof *Profiles) Blocked() ([]BlockedUser, error)

Blocked returns a list of blocked profiles.

func (*Profiles) ByID

func (prof *Profiles) ByID(id int64) (*User, error)

ByID returns a *User structure parsed by user id

func (*Profiles) ByName

func (prof *Profiles) ByName(name string) (*User, error)

ByName return a *User structure parsed by username

type RecentItems

type RecentItems 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"`
}

TODO: Needs to be updated

type SavedMedia

type SavedMedia struct {
	Items []MediaItem `json:"items"`

	NumResults          int    `json:"num_results"`
	MoreAvailable       bool   `json:"more_available"`
	AutoLoadMoreEnabled bool   `json:"auto_load_more_enabled"`
	Status              string `json:"status"`

	NextID interface{} `json:"next_max_id"`
	// contains filtered or unexported fields
}

SavedMedia stores the information about media being saved before in my account.

func (*SavedMedia) Delete

func (media *SavedMedia) Delete() error

Delete method TODO

I think this method should use the Unsave method, instead of the Delete.

func (*SavedMedia) Error

func (media *SavedMedia) Error() error

Error returns the SavedMedia error

func (*SavedMedia) ID

func (media *SavedMedia) ID() string

ID returns the SavedMedia next id

func (*SavedMedia) Next

func (media *SavedMedia) Next(params ...interface{}) bool

Next allows pagination

type School

type School struct{}

School is void structure (yet).

type ScoresBootstrapUsers

type ScoresBootstrapUsers struct {
	Status   string `json:"status"`
	Surfaces []struct {
		Name      string         `json:"name"`
		RankToken string         `json:"rank_token"`
		Scores    map[string]int `json:"scores"`
		TTLSecs   int            `json:"ttl_secs"`
	} `json:"surfaces"`
	Users []User `json:"users"`
}
type Search struct {
	// contains filtered or unexported fields
}

Search is the object for all searches like Facebook, Location or Tag search.

func (*Search) Facebook

func (search *Search) Facebook(user string) (*SearchResult, error)

Facebook search by facebook user.

func (*Search) Location

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) Tags

func (search *Search) Tags(tag string) (*SearchResult, error)

Tags search by tag

func (*Search) User

func (search *Search) User(user string, countParam ...int) (*SearchResult, error)

User search by username, you can use count optional parameter to get more than 50 items.

type SearchResult

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"`
	Hashtags []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

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

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

type StoryMedia struct {
	Pk                     interface{} `json:"id"`
	MediaCount             int64       `json:"media_count"`
	MediaIDs               []int64     `json:"media_ids"`
	Muted                  bool        `json:"muted"`
	LatestReelMedia        int64       `json:"latest_reel_media"`
	LatestBestiesReelMedia float64     `json:"latest_besties_reel_media"`
	ExpiringAt             float64     `json:"expiring_at"`
	Seen                   float64     `json:"seen"`
	SeenRankedPosition     int         `json:"seen_ranked_position"`
	CanReply               bool        `json:"can_reply"`
	CanGifQuickReply       bool        `json:"can_gif_quick_reply"`
	ClientPrefetchScore    float64     `json:"client_prefetch_score"`
	Title                  string      `json:"title"`
	CanReshare             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"`
	HasPrideMedia         bool        `json:"has_pride_media"`
	HasVideo              bool        `json:"has_video"`
	IsCacheable           bool        `json:"is_cacheable"`
	IsSensitiveVerticalAd bool        `json:"is_sensitive_vertical_ad"`
	RankedPosition        int         `json:"ranked_position"`
	RankerScores          struct {
		Fp   float64 `json:"fp"`
		Ptap float64 `json:"ptap"`
		Vm   float64 `json:"vm"`
	} `json:"ranker_scores"`
	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 (*StoryMedia) Delete

func (media *StoryMedia) Delete() error

Delete removes instragram story.

See example: examples/media/deleteStories.go

func (StoryMedia) Error

func (media StoryMedia) Error() error

Error returns error happened any error

func (*StoryMedia) ID

func (media *StoryMedia) ID() string

ID returns Story id

func (*StoryMedia) Next

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 (*StoryMedia) Sync

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

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"`
	IsSticker   int     `json:"is_sticker"`
	IsFBSticker int     `json:"is_fb_sticker"`
	User        User
	DisplayType string `json:"display_type"`
}

StoryReelMention represent story reel mention

type SuggestedUsers

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

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

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

type Timeline struct {
	Items []Item
	Tray  Tray

	More_available            bool
	NextID                    string
	Num_results               float64
	Preload_distance          float64
	Pull_to_refresh_window_ms float64
	Request_id                string
	Session_id                string
	// 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.

func (*Timeline) Broadcasts

func (tl *Timeline) Broadcasts() []Broadcast

helper function to get the Broadcasts

func (*Timeline) ClearPosts

func (tl *Timeline) ClearPosts()

func (*Timeline) Next

func (tl *Timeline) Next() bool

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. starts first request will be a cold start

func (*Timeline) Refresh

func (tl *Timeline) Refresh() error

func (*Timeline) SetPullRefresh

func (tl *Timeline) SetPullRefresh()

func (*Timeline) Stories

func (tl *Timeline) Stories() []StoryMedia

helper function to get the stories

func (*Timeline) UnsetPullRefresh

func (tl *Timeline) UnsetPullRefresh()

type Tray

type Tray struct {
	Stories []StoryMedia `json:"tray"`
	// think this is depricated, and only broadcasts are used
	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"`
	NuxElegible          bool        `json:"stories_viewer_gestures_nux_eligible"`
	StickerVersion       float64     `json:"sticker_version"`
	ReponseTS            float64     `json:"response_timestamp"`
	Status               string      `json:"status"`
	EmojiReactionsConfig struct {
		UfiType                        float64 `json:"ufi_type"`
		DeliveryType                   float64 `json:"delivery_type"`
		OverlaySkinTonePickerEnabled   bool    `json:"overlay_skin_tone_picker_enabled"`
		SwipeUpToShowReactions         bool    `json:"swipe_up_to_show_reactions"`
		ComposerNuxType                float64 `json:"composer_nux_type"`
		HideStoryViewCount             bool    `json:"hide_story_view_count"`
		ReactionTrayInteractivePanning bool    `json:"reaction_tray_interactive_panning_enabled"`
		PersistentSelfStoryBadge       bool    `json:"persistent_self_story_badge_enabled"`
		SelfstoryBadging               bool    `json:"self_story_badging_enabled"`
		ExitTestNux                    bool    `json:"exit_test_nux_enabled"`
	} `json:"emoji_reactions_config"`
}

Tray is a set of story media received from timeline calls.

type User

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"`
	UsertagsCount                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

func (*User) Block

func (user *User) Block() error

Block blocks user

This function updates current User.Friendship structure.

See example: examples/user/block.go

func (*User) Feed

func (user *User) Feed(params ...interface{}) *FeedMedia

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

func (*User) Follow

func (user *User) Follow() error

Follow started following some user

This function performs a follow call. If user is private you have to wait until he/she accepts you.

If the account is public User.Friendship will be updated

See example: examples/user/follow.go

func (*User) Followers

func (user *User) Followers() *Users

Followers returns a list of user followers.

Users.Next can be used to paginate

See example: examples/user/followers.go

func (*User) Following

func (user *User) Following() *Users

Following returns a list of user following.

Users.Next can be used to paginate

See example: examples/user/following.go

func (*User) FriendShip

func (user *User) FriendShip() error

FriendShip allows user to get friend relationship.

The result is stored in user.Friendship

func (*User) Highlights

func (user *User) Highlights() ([]StoryMedia, error)

Highlights represents saved stories.

See example: examples/user/highlights.go

func (*User) Mute

func (user *User) Mute(opt muteOption) error

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.

func (*User) SetInstagram

func (user *User) SetInstagram(insta *Instagram)

SetInstagram will update instagram instance for selected User.

func (*User) Stories

func (user *User) Stories() *StoryMedia

Stories returns user stories

Use StoryMedia.Next for pagination.

See example: examples/user/stories.go

func (*User) Sync

func (user *User) Sync(params ...interface{}) error

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

func (*User) Tags

func (user *User) Tags(minTimestamp []byte) (*FeedMedia, error)

Tags returns media where user is tagged in

For pagination use FeedMedia.Next()

See example: examples/user/tags.go

func (*User) Unblock

func (user *User) Unblock() error

Unblock unblocks user

This function updates current User.Friendship structure.

See example: examples/user/unblock.go

func (*User) Unfollow

func (user *User) Unfollow() error

Unfollow unfollows user

User.Friendship will be updated

See example: examples/user/unfollow.go

func (*User) Unmute

func (user *User) Unmute(opt muteOption) error

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

type Users struct {
	Status    string          `json:"status"`
	BigList   bool            `json:"big_list"`
	Users     []User          `json:"users"`
	PageSize  int             `json:"page_size"`
	RawNextID json.RawMessage `json:"next_max_id"`
	NextID    string          `json:"-"`
	// contains filtered or unexported fields
}

Users is a struct that stores many user's returned by many different methods.

func (*Users) Error

func (users *Users) Error() error

Error returns users error

func (*Users) Next

func (users *Users) Next() bool

Next allows to paginate after calling: Account.Follow* and User.Follow*

New user list is stored inside Users

returns false when list reach the end.

func (*Users) SetInstagram

func (users *Users) SetInstagram(insta *Instagram)

SetInstagram sets new instagram to user structure

type Video

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL