goinsta

package module
v3.0.0-...-b1f3115 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 37 Imported by: 0

README

goinsta logo

GoDoc Go Report Card

Go Instagram Private API

Unofficial Instagram API for Golang

This repository has been forked from ahmdrz/goinsta. As the maintainer of this repositry has archived the project, and the code in the repository was based on a few year old instagram app version, since which a lot has changed, I have taken the courtesy to build upon his great framework and update the code to be compatible with apk v250.0.0.21.109 (Aug 30, 2022). Walkthrough docs can be found in the wiki.

If you are missing anything or something is not working as expected please let me know through the issues or discussions.

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 Exportand Importfunctions.
  • 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. goinsta now uses chromedp as headless browser driver to solve challanges and checkpoints.

Package installation

go get -u github.com/loopo-org/goinsta/v3@latest

Example

package main

import (
	"fmt"

	"github.com/loopo-org/goinsta/v3"
)

func main() {  
  insta := goinsta.New("USERNAME", "PASSWORD")
  
  // Only call Login the first time you login. Next time import your config
  if err := insta.Login(); err != nil {
          panic(err)
  }

  // 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.
  // Export is deffered because every run insta should be exported at the end of the run
  //   as the header cookies change constantly.
  defer insta.Export("~/.goinsta")

  ...
}

For the full documentation, check the wiki, or run go doc -all.

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.

Documentation

Index

Constants

View Source
const (
	MuteAll   muteOption = "all"
	MuteStory muteOption = "reel"
	MutePosts muteOption = "post"
)
View Source
const (
	TooManyRequestsTimeout = 60 * time.Second
)

Variables

View Source
var (

	// Default Device
	GalaxyS10 = Device{
		Manufacturer:     "samsung",
		Model:            "SM-G975F",
		CodeName:         "beyond2",
		AndroidVersion:   30,
		AndroidRelease:   11,
		ScreenDpi:        "560dpi",
		ScreenResolution: "1440x2898",
		Chipset:          "exynos9820",
	}
	G6 = Device{
		Manufacturer:     "LGE/lge",
		Model:            "LG-H870DS",
		CodeName:         "lucye",
		AndroidVersion:   28,
		AndroidRelease:   9,
		ScreenDpi:        "560dpi",
		ScreenResolution: "1440x2698",
		Chipset:          "lucye",
	}
)
View Source
var (
	RespErr2FA = "two_factor_required"

	// Account & Login Errors
	ErrBadPassword     = errors.New("password is incorrect")
	ErrTooManyRequests = errors.New("too many requests, please wait a few minutes before you try again")
	ErrLoggedOut       = errors.New("you have been logged out, please log back in")
	ErrLoginRequired   = errors.New("you are not logged in, please login")
	ErrSessionNotSet   = errors.New("session identifier is not set, please log in again to set it")
	ErrLogoutFailed    = errors.New("failed to logout")

	ErrChallengeRequired  = errors.New("challenge required")
	ErrCheckpointRequired = errors.New("checkpoint required")
	ErrCheckpointPassed   = errors.New("a checkpoint was thrown, but goinsta managed to solve it. Please call the function again")
	ErrChallengeFailed    = errors.New("failed to solve challenge automatically")

	Err2FARequired = errors.New("two Factor Autentication required. Please call insta.TwoFactorInfo.Login2FA(code)")
	Err2FANoCode   = errors.New("2FA seed is not set, and no code was provided. Please do atleast one of them")
	ErrInvalidCode = errors.New("the security code provided is incorrect")

	// Upload Errors
	ErrInvalidFormat      = errors.New("invalid file type, please use one of jpeg, jpg, mp4")
	ErrInvalidImage       = errors.New("invalid file type, please use a jpeg or jpg image")
	ErrCarouselType       = ErrInvalidImage
	ErrCarouselMediaLimit = errors.New("carousel media limit of 10 exceeded")
	ErrStoryBadMediaType  = errors.New("when uploading multiple items to your story at once, all have to be mp4")
	ErrStoryMediaTooLong  = errors.New("story media must not exceed 15 seconds per item")

	// Search Errors
	ErrSearchUserNotFound = errors.New("User not found in search result")

	// IGTV
	ErrIGTVNoSeries = errors.New(
		"User has no IGTV series, unable to fetch. If you think this was a mistake please update the user",
	)

	// Feed Errors
	ErrInvalidTab   = errors.New("invalid tab, please select top or recent")
	ErrNoMore       = errors.New("no more posts availible, page end has been reached")
	ErrNotHighlight = errors.New("unable to sync, Reel is not of type highlight")
	ErrMediaDeleted = errors.New("sorry, this media has been deleted")

	// Inbox
	ErrConvNotPending = errors.New("unable to perform action, conversation is not pending")

	// Misc
	ErrByteIndexNotFound = errors.New("failed to index byte slice, delim not found")
	ErrNoMedia           = errors.New("failed to download, no media found")
	ErrInstaNotDefined   = errors.New(
		"insta has not been defined, this is most likely a bug in the code. Please backtrack which call this error came from, and open an issue detailing exactly how you got to this error",
	)
	ErrNoValidLogin    = errors.New("no valid login found")
	ErrNoProfilePicURL = errors.New("no profile picture url was found. Please fetch the profile first")

	// Users
	ErrNoPendingFriendship = errors.New("unable to approve or ignore friendship for user, as there is no pending friendship request")

	// Headless
	ErrChromeNotFound = errors.New("to solve challenges a (headless) Chrome browser is used, but none was found. Please install Chromium or Google Chrome, and try again")
)

Errors

View Source
var (
	PULLTOREFRESH fetchReason = "pull_to_refresh"
	COLDSTART     fetchReason = "cold_start_fetch"
	WARMSTART     fetchReason = "warm_start_fetch"
	PAGINATION    fetchReason = "pagination"
	AUTOREFRESH   fetchReason = "auto_refresh" // so far unused
)
View Source
var ErrAllSaved = errors.New("unable to call function for collection all posts")

Functions

func EnvProvision

func EnvProvision(path string, refresh ...bool) error

EnvProvision will check the environment variables for INSTAGRAM_ACT_ and

create a base64 encoded config for the account, and write it to path.

:param: path - path a file to use as env, commonly a .env, but not required. :param: refresh (OPTIONAL) - refresh all plaintext credentials, don't skip already converted accounts

This function has been created the use of a .env file in mind.

.env contents:

INSTAGRAM_ACT_<name>="user:pass"

This function will add to the .env:

INSTAGRAM_BASE64_<name>="..."

func EnvRandLogin

func EnvRandLogin(path ...string) (string, string, error)

EnvRandLogin fetches a random login from the env. :param: path (OPTIONAL) - path to a file, by default .env

Looks for INSTAGRAM_ACT_<name>="username:password" in env

func EnvUpdateAccs

func EnvUpdateAccs(path string, newAccs []*EnvAcc) error

EnvUpdateAccs will update the plain and encoded account variables stored in

the .env file:

 INSTAGRAM_ACT_<name>="username:password"
 INSTAGRAM_BASE64_<name>="<base64 encoded config>"

:param: string:path -- file path of the .env file, typically ".env" :param: []*EncAcc:newAccs -- list of updated versions of the accounts

func EnvUpdateEnc

func EnvUpdateEnc(path string, newAccs []*EnvEncAcc) error

EnvUpdateEnc will update the encoded account variables stored in

the .env file:

 INSTAGRAM_BASE64_<name>="<base64 encoded config>"

:param: string:path -- file path of the .env file, typically ".env" :param: []*EnvEncAcc:newAccs -- list of updated encoded accounts

func EnvUpdatePlain

func EnvUpdatePlain(path string, newAccs []*EnvPlainAcc) error

EnvPlainAccs will update the plain account variables stored in

the .env file:

 INSTAGRAM_ACT_<name>="username:password"

:param: string:path -- file path of the .env file, typically ".env" :param: []*EnvPlainAcc:newAccs -- list of updated plain accounts

func GetBest

func GetBest(obj interface{}) string

GetBest returns url to best quality image or video.

Arguments can be []Video or []Candidate

func MediaIDFromShortID

func MediaIDFromShortID(code string) (string, error)

func MediaToString

func MediaToString(t int) string

func MergeMapI

func MergeMapI(one map[string]interface{}, extra ...map[string]interface{}) map[string]interface{}

func MergeMapS

func MergeMapS(one map[string]string, extra ...map[string]string) map[string]string

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

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

EditBiography changes your Instagram's biography.

This function updates current Account information.

func (*Account) EditName

func (account *Account) EditName(name string) error

EditName changes your Instagram account name.

This function updates current Account information.

func (*Account) EditUrl

func (account *Account) EditUrl(url string) error

EditUrl changes your Instagram account url.

This function updates current Account information.

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(query string) *Users

Followers returns a list of user followers.

Query can be used to search for a specific user. Be aware that it only matches from the start, e.g. "theprimeagen" will only match "theprime" not "prime". To fetch all user an empty string "".

Users.Next can be used to paginate

func (*Account) Following

func (account *Account) Following(query string, order FollowOrder) *Users

Following returns a list of user following.

Query can be used to search for a specific user. Be aware that it only matches from the start, e.g. "theprimeagen" will only match "theprime" not "prime". To fetch all user an empty string "".

Users.Next can be used to paginate

func (*Account) FriendhipsShowMany

func (account *Account) FriendhipsShowMany(userIds []string) (map[string]Friendship, error)

func (*Account) GetEnvEncAcc

func (acc *Account) GetEnvEncAcc() (*EnvEncAcc, error)

func (*Account) Liked

func (account *Account) Liked() *FeedMedia

Liked are liked publications

func (*Account) PendingFollowRequests

func (account *Account) PendingFollowRequests() (*PendingRequests, error)

PendingFollowRequests returns pending follow requests.

func (*Account) PendingRequestCount

func (account *Account) PendingRequestCount() (int, error)

PendingRequestCount returns the number of open pending friendships as int

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) 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, error)

Stories returns account stories.

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(form map[string]string) error

UpdateProfile method allows you to update your current account information. :param: form takes a map[string]string, the common values are:

external_url phone_number username first_name -- is actually your full name biography email

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

func (act *Activity) MarkAsSeen() error

MarkAsSeen will let instagram know you visited the activity page, and mark

current items as seen.

func (*Activity) Next

func (act *Activity) Next() bool

Next function allows pagination over notifications.

See example: examples/activity/recent.go

type AnimatedMedia

type AnimatedMedia struct {
	ID     string `json:"id"`
	Images struct {
		FixedHeight struct {
			Height   string `json:"height"`
			Mp4      string `json:"mp4"`
			Mp4Size  string `json:"mp4_size"`
			Size     string `json:"size"`
			URL      string `json:"url"`
			Webp     string `json:"webp"`
			WebpSize string `json:"webp_size"`
			Width    string `json:"width"`
		} `json:"fixed_height"`
	} `json:"images"`
	IsRandom  bool `json:"is_random"`
	IsSticker bool `json:"is_sticker"`
}

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 is either "active", "interrupted", "stopped"
	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"`
	User                      User    `json:"broadcast_owner"`
	Cobroadcasters            []*User `json:"cobroadcasters"`
	PublishedTime             int64   `json:"published_time"`
	Message                   string  `json:"broadcast_message"`
	OrganicTrackingToken      string  `json:"organic_tracking_token"`
	IsPlayerLiveTrace         int     `json:"is_player_live_trace_enabled"`
	IsGamingContent           bool    `json:"is_gaming_content"`
	IsViewerCommentAllowed    bool    `json:"is_viewer_comment_allowed"`
	IsPolicyViolation         bool    `json:"is_policy_violation"`
	PolicyViolationReason     string  `json:"policy_violation_reason"`
	LiveCommentMentionEnabled bool    `json:"is_live_comment_mention_enabled"`
	LiveCommentRepliesEnabled bool    `json:"is_live_comment_replies_enabled"`
	HideFromFeedUnit          bool    `json:"hide_from_feed_unit"`
	VideoDuration             float64 `json:"video_duration"`
	Visibility                int     `json:"visibility"`
	ViewerCount               float64 `json:"viewer_count"`
	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"`
	PayViewerConfig struct {
		PayConfig struct {
			ConsumptionSheetConfig struct {
				Description               string `json:"description"`
				PrivacyDisclaimer         string `json:"privacy_disclaimer"`
				PrivacyDisclaimerLink     string `json:"privacy_disclaimer_link"`
				PrivacyDisclaimerLinkText string `json:"privacy_disclaimer_link_text"`
			} `json:"consumption_sheet_config"`
			DigitalNonConsumableProductID int64 `json:"digital_non_consumable_product_id"`
			DigitalProductID              int64 `json:"digital_product_id"`
			PayeeID                       int64 `json:"payee_id"`
			PinnedRowConfig               struct {
				ButtonTitle string `json:"button_title"`
				Description string `json:"description"`
			} `json:"pinned_row_config"`
			TierInfos []struct {
				DigitalProductID int64  `json:"digital_product_id"`
				Sku              string `json:"sku"`
				SupportTier      string `json:"support_tier"`
			} `json:"tier_infos"`
		} `json:"pay_config"`
	} `json:"user_pay_viewer_config"`
	// contains filtered or unexported fields
}

Broadcast struct represents live video streams.

func (*Broadcast) Discover

func (br *Broadcast) Discover() (*IGTVChannel, error)

Discover wraps Instagram.IGTV.Live

func (*Broadcast) DownloadCoverFrame

func (br *Broadcast) DownloadCoverFrame() ([]byte, error)

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

GetInfo will fetch the information about a broadcast

func (*Broadcast) GetLikes

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

Call every 6 seconds

func (*Broadcast) GetLiveChaining

func (br *Broadcast) GetLiveChaining() ([]*Broadcast, error)

GetLiveChaining traditionally gets called after the live stream has ended, and provides

recommendations of other current live streams, as well as past live streams.

type BroadcastComments

type BroadcastComments struct {
	CommentLikesEnabled        bool       `json:"comment_likes_enabled"`
	Comments                   []*Comment `json:"comments"`
	PinnedComment              *Comment   `json:"pinned_comment"`
	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"`
	UserPaySupportersInfo      struct {
		SupportersInComments   map[string]interface{} `json:"supporters_in_comments"`
		SupportersInCommentsV2 map[string]interface{} `json:"supporters_in_comments_v2"`
		// SupportersInCommentsV2 map[string]struct {
		// 	SupportTier string `json:"support_tier"`
		// 	BadgesCount int    `json:"badges_count"`
		// } `json:"supporters_in_comments_v2"`
		NewSupportersNextMinID int64          `json:"new_supporters_next_min_id"`
		NewSupporters          []NewSupporter `json:"new_supporters"`
	} `json:"user_pay_supporter_info"`
	Status string `json:"status"`
}

type BroadcastHeartbeat

type BroadcastHeartbeat struct {
	ViewerCount             float64  `json:"viewer_count"`
	BroadcastStatus         string   `json:"broadcast_status"`
	CobroadcasterIds        []string `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     []struct {
		UserID        int64  `json:"user_id"`
		ProfilePicUrl string `json:"profile_pic_url"`
		Count         string `json:"count"`
	} `json:"likers"`
	LikeTs           int64  `json:"like_ts"`
	Status           string `json:"status"`
	PaySupporterInfo struct {
		LikeCountByTier []struct {
			BurstLikes  int           `json:"burst_likes"`
			Likers      []interface{} `json:"likers"`
			Likes       int           `json:"likes"`
			SupportTier string        `json:"support_tier"`
		} `json:"like_count_by_support_tier"`
		BurstLikes int `json:"supporter_tier_burst_likes"`
		Likes      int `json:"supporter_tier_likes"`
	} `json:"user_pay_supporter_info"`
}

type Candidate

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

Candidate is something that I really have no idea what it is.

type Caption

type Caption struct {
	// can be both string or int
	ID              interface{} `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 {
	LoggedInUser *Account `json:"logged_in_user,omitempty"`
	UserID       int64    `json:"user_id"`
	Status       string   `json:"status"`

	Errors []string `json:"errors"`

	URL               string            `json:"url"`
	ApiPath           string            `json:"api_path"`
	Context           *ChallengeContext `json:"challenge_context"`
	FlowRenderType    int               `json:"flow_render_type"`
	HideWebviewHeader bool              `json:"hide_webview_header"`
	Lock              bool              `json:"lock"`
	Logout            bool              `json:"logout"`
	NativeFlow        bool              `json:"native_flow"`

	TwoFactorRequired bool
	TwoFactorInfo     TwoFactorInfo
	// contains filtered or unexported fields
}

Challenge is a status code 400 error, usually prompting the user to perform

some action.

func (*Challenge) Process

func (c *Challenge) Process() error

Process will open up the challenge url in a chromium browser and

take a screenshot. Please report the screenshot and printed out struct so challenge
automation can be build in.

func (*Challenge) ProcessOld

func (c *Challenge) ProcessOld(apiURL string) error

func (*Challenge) SendSecurityCode

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

sendSecurityCode sends the code received in the message

type ChallengeContext

type ChallengeContext struct {
	TypeEnum    string            `json:"challenge_type_enum"`
	IsStateless bool              `json:"is_stateless"`
	Action      string            `json:"action"`
	NonceCode   string            `json:"nonce_code"`
	StepName    string            `json:"step_name"`
	StepData    ChallengeStepData `json:"step_data"`
	UserID      int64             `json:"user_id"`
}

type ChallengeError

type ChallengeError struct {
	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"`
	Message   string `json:"message"`
	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 Checkpoint

type Checkpoint struct {
	URL            string `json:"checkpoint_url"`
	Lock           bool   `json:"lock"`
	FlowRenderType int    `json:"flow_render_type"`
	// contains filtered or unexported fields
}

Checkpoint is just like challenge, a status code 400 error. Usually used to prompt the user to accept cookies.

func (*Checkpoint) Process

func (c *Checkpoint) Process() error

Process will open up the url passed as a checkpoint response (not a challenge)

in a headless browser. This method is experimental, please report if you still
get a /privacy/checks/ checkpoint error.

type Collection

type Collection struct {
	ID         string `json:"collection_id"`
	MediaCount int    `json:"collection_media_count"`
	Name       string `json:"collection_name"`
	Type       string `json:"collection_type"`
	Cover      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"`
	} `json:"cover_media"`

	Items         []Item
	NumResults    int         `json:"num_results"`
	MoreAvailable bool        `json:"more_available"`
	NextID        interface{} `json:"next_max_id"`
	// contains filtered or unexported fields
}

Collection represents a single collection. All collections will not load

any posts by default. To load the posts you need to call Collection.Next()

You can edit your collections with their respective methods. e.g. edit the name

or change the thumbnail.

func (*Collection) AddCollaborators

func (c *Collection) AddCollaborators(colab ...User) error

AddCollaborators should in theory add collaborators. Untested.

func (*Collection) ChangeCover

func (c *Collection) ChangeCover(item Item) error

ChangeCover will change to cover of the collection. The item parameter must

must be an item that is present inside the collection.

func (*Collection) ChangeName

func (c *Collection) ChangeName(name string) error

ChangeName will change the name of the collection

func (*Collection) Delete

func (c *Collection) Delete() error

Delete will permanently delete a collection

func (*Collection) Error

func (c *Collection) Error() error

Error will return the error if one occured during Collection.Next().

func (*Collection) GetNextID

func (c *Collection) GetNextID() string

GetNextID will return the pagination ID as a string

func (*Collection) Next

func (c *Collection) Next(params ...interface{}) bool

Next allows you to fetch and paginate over all items present inside a collection.

func (*Collection) RemoveMedia

func (c *Collection) RemoveMedia(items ...Item) error

RemoveMedia will remove media from a collection. The items provided must be

inside the collection

func (*Collection) Sync

func (c *Collection) Sync() error

Sync will fetch the initial items inside a collection. The first call to fetch posts will always be sync, however you can also only

call Collection.Next() as Sync() will automatically be called if required.

type Collections

type Collections struct {
	AutoLoadMoreEnabled bool          `json:"auto_load_more_enabled"`
	Items               []*Collection `json:"items"`
	MoreAvailable       bool          `json:"more_available"`
	NextID              string        `json:"next_max_id"`
	NumResults          int
	Status              string `json:"status"`
	// contains filtered or unexported fields
}

Collections stores information about all your collection. The first collection will always be the "All Posts" collcetion. To fetch all collections, you can paginate with Collections.Next()

func (*Collections) Create

func (c *Collections) Create(name string, items ...Item) (*Collection, error)

Create allows you to create a new collection. :param: name (*required) - the name of the collection :param: ...Items (optional) - posts to add to the collection

func (*Collections) Error

func (c *Collections) Error() error

Error returns the error if one occured in Collections.Next()

func (*Collections) Latest

func (c *Collections) Latest() []*Collection

Latest will return the last fetched items by indexing with Collections.LastCount. Collections.Next keeps adding to the items, this method only returns the latest items.

func (*Collections) Next

func (c *Collections) Next() bool

Next allows you to fetch and paginate your list of collections. This method will cumulatively add to the collections. To get the latest

fetched collections, call Collections.Latest(), or index with Collections.LastCount

type Comment

type Comment struct {
	ID                             interface{} `json:"pk"`
	Text                           string      `json:"text"`
	Type                           interface{} `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"`
	ShareEnabled                   bool        `json:"share_enabled"`
	IsCovered                      bool        `json:"is_covered"`
	PrivateReplyStatus             int64       `json:"private_reply_status"`
	SupporterInfo                  struct {
		SupportTier string `json:"support_tier"`
		BadgesCount int    `json:"badges_count"`
	} `json:"supporter_info"`
	Status string `json:"status"`
	// contains filtered or unexported fields
}

Comment is a type of Media retrieved by the Comments methods

func (*Comment) Delete

func (c *Comment) Delete() error

Delete deletes a single comment.

func (*Comment) Like

func (c *Comment) Like() error

Like likes comment.

func (*Comment) Unlike

func (c *Comment) Unlike() error

Unlike unlikes comment.

type CommentInfo

type CommentInfo struct {
	LikesEnabled                   bool          `json:"comment_likes_enabled"`
	ThreadingEnabled               bool          `json:"comment_threading_enabled"`
	HasMore                        bool          `json:"has_more_comments"`
	MaxNumVisiblePreview           int           `json:"max_num_visible_preview_comments"`
	PreviewComments                []interface{} `json:"preview_comments"`
	CanViewMorePreview             bool          `json:"can_view_more_preview_comments"`
	CommentCount                   int           `json:"comment_count"`
	HideViewAllCommentEntrypoint   bool          `json:"hide_view_all_comment_entrypoint"`
	InlineComposerDisplayCondition string        `json:"inline_composer_display_condition"`
	InlineComposerImpTriggerTime   int           `json:"inline_composer_imp_trigger_time"`
}

type CommentOffensive

type CommentOffensive struct {
	BullyClassifier  float64 `json:"bully_classifier"`
	SexualClassifier float64 `json:"sexual_classifier"`
	HateClassifier   float64 `json:"hate_classifier"`
	IsOffensive      bool    `json:"is_offensive"`
	Status           string  `json:"status"`
	TextLanguage     string  `json:"text_language"`
}

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"`
	NextID                         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.

See example: examples/media/commentsAdd.go

func (*Comments) BulkDelete

func (comments *Comments) BulkDelete(c []*Comment) error

BulkDelete allows you to select and delete multiple comments on a single post.

func (*Comments) DeleteMine

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

DeleteMine removes all of your comments limited by parsed parameter.

If limit is <= 0 DeleteMine will delete all your comments. Be careful with using this on posts with a large number of comments,

as a large number of requests will be made to index all comments.This
can result in a ratelimiter being tripped.

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"`
	Account       *Account          `json:"account"`
	Device        Device            `json:"device"`
	TOTP          *TOTP             `json:"totp"`
	SessionNonce  string            `json:"session"`
}

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"`
	AdminUserIDs               []int64               `json:"admin_user_ids"`
	ApprovalRequiredNewMembers bool                  `json:"approval_required_for_new_members"`
	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"`
	Named                      bool                  `json:"named"`
	Muted                      bool                  `json:"muted"`
	Spam                       bool                  `json:"spam"`
	ShhModeEnabled             bool                  `json:"shh_mode_enabled"`
	ShhReplayEnabled           bool                  `json:"shh_replay_enabled"`
	IsPin                      bool                  `json:"is_pin"`
	IsGroup                    bool                  `json:"is_group"`
	IsVerifiedThread           bool                  `json:"is_verified_thread"`
	IsCloseFriendThread        bool                  `json:"is_close_friend_thread"`
	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"`
	HasRestrictedUser          bool                  `json:"has_restricted_user"`
	Archived                   bool                  `json:"archived"`
	LastSeenAt                 map[string]lastSeenAt `json:"last_seen_at"`
	NewestCursor               string                `json:"newest_cursor"`
	OldestCursor               string                `json:"oldest_cursor"`

	LastPermanentItem InboxItem `json:"last_permanent_item"`
	// contains filtered or unexported fields
}

Conversation is the representation of an instagram already established conversation through direct messages.

func (*Conversation) Approve

func (c *Conversation) Approve() error

Approve a pending direct message.

func (*Conversation) Error

func (c *Conversation) Error() error

Error will return Conversation.err

func (*Conversation) GetItems

func (c *Conversation) GetItems() error

GetItems is an alternative way to get conversation messages, e.g. refresh. The app calls this when approving a DM request, for example.

func (*Conversation) Hide

func (conv *Conversation) Hide() error

func (*Conversation) MarkAsSeen

func (c *Conversation) MarkAsSeen(msg InboxItem) error

MarkAsSeen will marks a message as seen.

func (*Conversation) Next

func (c *Conversation) Next() bool

Next loads older messages if available. If not it will call Refresh().

func (*Conversation) Refresh

func (c *Conversation) Refresh() error

Refresh will fetch a conversation's unseen messages.

func (*Conversation) Send

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

Send sends message in conversation

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 Device

type Device struct {
	Manufacturer     string `json:"manufacturer"`
	Model            string `json:"model"`
	CodeName         string `json:"code_name"`
	AndroidVersion   int    `json:"android_version"`
	AndroidRelease   int    `json:"android_release"`
	ScreenDpi        string `json:"screen_dpi"`
	ScreenResolution string `json:"screen_resolution"`
	Chipset          string `json:"chipset"`
}

type Discover

type Discover struct {
	Items      []DiscoverSectionalItem
	NumResults int

	AutoLoadMoreEnabled bool `json:"auto_load_more_enabled"`
	Clusters            []struct {
		CanMute     bool        `json:"can_mute"`
		Context     string      `json:"context"`
		DebugInfo   string      `json:"debug_info"`
		Description string      `json:"description"`
		ID          interface{} `json:"id"`
		IsMuted     bool        `json:"is_muted"`
		Labels      interface{} `json:"labels"`
		Name        string      `json:"name"`
		Title       string      `json:"title"`
		Type        string      `json:"type"`
	} `json:"clusters"`
	MaxID              string                  `json:"max_id"`
	MoreAvailable      bool                    `json:"more_available"`
	NextID             string                  `json:"next_max_id"`
	RankToken          string                  `json:"rank_token"`
	SectionalItems     []DiscoverSectionalItem `json:"sectional_items"`
	SessionPagingToken string                  `json:"session_paging_token"`
	Status             string                  `json:"status"`
	// contains filtered or unexported fields
}

func (*Discover) Error

func (disc *Discover) Error() error

Error will return the error, if one is present

func (*Discover) Next

func (disc *Discover) Next() bool

Next allows you to paginate explore page results. Also use this for your

first fetch

func (*Discover) Refresh

func (disc *Discover) Refresh() bool

Refresh will remove the session token, and frefresh the results, like a pull down

type DiscoverMediaItem

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

type DiscoverSectionalItem

type DiscoverSectionalItem struct {
	ExploreItemInfo struct {
		AspectRatio     float64 `json:"aspect_ratio"`
		Autoplay        bool    `json:"autoplay"`
		NumColumns      int     `json:"num_columns"`
		TotalNumColumns int     `json:"total_num_columns"`
	} `json:"explore_item_info"`
	FeedType      string `json:"feed_type"`
	LayoutContent struct {
		// Usually not all of these are filled
		// I have often seen the 1 out of 5 items being the ThreeByFour
		//   and the third item the TwoByTwoItems + Fill Items,
		//   the others tend to be Medias, but this is not always the case
		LayoutType string              `json:"layout_type"`
		Medias     []DiscoverMediaItem `json:"medias"`

		FillItems    []DiscoverMediaItem `json:"fill_items"`
		OneByOneItem DiscoverMediaItem   `json:"one_by_one"`
		TwoByTwoItem DiscoverMediaItem   `json:"two_by_two_item"`

		ThreeByFourItem struct {
			// TODO: this is a reels section, which you can paginate on its own
			Clips struct {
				ContentSource string              `json:"content_source"`
				Design        string              `json:"design"`
				ID            string              `json:"id"`
				Items         []DiscoverMediaItem `json:"items"`
				Label         string              `json:"label"`
				MaxID         string              `json:"max_id"`
				MoreAvailable bool                `json:"more_available"`
				Type          string              `json:"type"`
			} `json:"clips"`
		} `json:"three_by_four_item"`
	} `json:"layout_content"`
	LayoutType string `json:"layout_type"`
}

type EnvAcc

type EnvAcc struct {
	Plain *EnvPlainAcc
	Enc   *EnvEncAcc
}

EnvAcc represents the pair of plain and base64 encoded account pairs as

stored in EnvPlainAcc and EnvEncAcc, with env variables:

INSTAGRAM_ACT_<name>="username:password"
INSTAGRAM_BASE64_<name>="<base64 encoded config>"

func EnvReadAccs

func EnvReadAccs(p ...string) ([]*EnvAcc, error)

EnvReadAccs loads both all plain and base64 encoded accounts

Set in a .env file or export to your environment variables:

INSTAGRAM_ACT_<name>="user:pass"
INSTAGRAM_BASE64_<name>="..."

:param: p (OPTIONAL) -- env file path, ".env" by default

type EnvEncAcc

type EnvEncAcc struct {
	Name     string
	Username string
	Base64   string
}

EnvEncAcc represents the encoded account details stored in the env variable:

INSTAGRAM_BASE64_<name>="<base64 encoded config>"

type EnvPlainAcc

type EnvPlainAcc struct {
	Name     string
	Username string
	Password string
}

EnvPlainAcc represents the plain account details stored in the env variable:

INSTAGRAM_ACT_<name>="username:password"

func EnvLoadPlain

func EnvLoadPlain(path ...string) ([]*EnvPlainAcc, error)

EnvLoadPlain will load all plain accounts stored in the env variables:

INSTAGRAM_ACT_<name>="username:password"

:param: path (OPTIONAL) -- .env file to load, default to ".env"

type ErrChallengeProcess

type ErrChallengeProcess struct {
	StepName string
}

func (ErrChallengeProcess) Error

func (ec ErrChallengeProcess) Error() string

type Error400

type Error400 struct {
	Checkpoint

	Status  string `json:"status"`
	Message string `json:"message"`

	ErrorType  string `json:"error_type"`
	ErrorTitle string `json:"error_title"`
	ErrorBody  string `json:"error_body"`

	// Status code
	Code int

	// The endpoint that returned the 400 status code
	Endpoint string `json:"endpoint"`

	Challenge         *Challenge     `json:"challenge"`
	TwoFactorRequired bool           `json:"two_factor_required"`
	TwoFactorInfo     *TwoFactorInfo `json:"two_factor_info"`

	// This is double, as also present inside TwoFactorInfo
	PhoneVerificationSettings phoneVerificationSettings `json:"phone_verification_settings"`

	Payload struct {
		ClientContext string `json:"client_context"`
		Message       string `json:"message"`
	} `json:"payload"`

	DebugInfo struct {
		Message   string `json:"string"`
		Retriable bool   `json:"retriable"`
		Type      string `json:"type"`
	} `json:"debug_info"`
}

Error400 is error returned by HTTP 400 status code.

func (Error400) Error

func (e Error400) Error() string

func (*Error400) GetMessage

func (e *Error400) GetMessage() 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"`
	Endpoint  string `json:"endpoint"`
	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

This method does not perform a search for a tag, but directly queries the

feed items for the specified Tag. The preffered way would be to search
for the tag, call TopSearchItem.RegisterClick(), and then fetch the feed.

This method uses an older endpoint, although it still seems to work. The preffered way to fetch Hashtag feeds is by using the Hashtag struct. This can be obtained from insta.NewHashtag(tag), or insta.Searchbar.SearchHashtag(tag)

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 Mainly used for user profile feeds. To get your main timeline use insta.Timeline

func (*FeedMedia) Delete

func (media *FeedMedia) Delete() error

Delete deletes ALL items in media. If you want to delete one item, pick one from media.Items and call Item.Delete()

See example: examples/media/mediaDelete.go

func (*FeedMedia) Error

func (media *FeedMedia) Error() error

func (*FeedMedia) GetCommentInfo

func (media *FeedMedia) GetCommentInfo() error

GetCommentInfo will fetch the item.CommentInfo; e.g. comment counts, and

other comment information for the feed.Latest() items

func (*FeedMedia) GetNextID

func (media *FeedMedia) GetNextID() string

ID returns media id.

func (*FeedMedia) Latest

func (media *FeedMedia) Latest() []*Item

Latest returns a slice of the latest fetched items of the list of all items. The Next method keeps adding to the list, with Latest you can retrieve only the newest items.

func (*FeedMedia) Next

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

Next allows pagination after calling: User.Feed extra query arguments can be passes one after another as func(key, value). Only if an even number of string arguements will be passed, they will be

used in the query.

returns false when list reach the end. if FeedMedia.Error() is ErrNoMore no problems have occurred.

func (*FeedMedia) SetID

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

SetID sets media.GetNextID 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"`
	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"`
	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 FollowOrder

type FollowOrder string
const (
	DefaultOrder  FollowOrder = "default"
	LatestOrder   FollowOrder = "date_followed_latest"
	EarliestOrder FollowOrder = "date_followed_earliest"
)

type Friendship

type Friendship struct {
	Following       bool `json:"following"`
	FollowedBy      bool `json:"followed_by"`
	IncomingRequest bool `json:"incoming_request"`
	OutgoingRequest bool `json:"outgoing_request"`
	Muting          bool `json:"muting"`
	Blocking        bool `json:"blocking"`
	IsBestie        bool `json:"is_bestie"`
	IsBlockingReel  bool `json:"is_blocking_reel"`
	IsMutingReel    bool `json:"is_muting_reel"`
	IsPrivate       bool `json:"is_private"`
	IsRestricted    bool `jsoN:"is_restricted"`
}

Friendship stores the details of the relationship between two users.

type Hashtag

type Hashtag struct {
	Name                string      `json:"name"`
	ID                  int64       `json:"id"`
	MediaCount          int         `json:"media_count"`
	FormattedMediaCount string      `json:"formatted_media_count"`
	FollowStatus        interface{} `json:"follow_status"`
	Subtitle            string      `json:"subtitle"`
	Description         string      `json:"description"`
	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"`
	// All Top Items
	Items []*Item
	// All ItemsRecent Items
	ItemsRecent []*Item
	Story       *StoryMedia
	NumResults  int

	// Sections will always contain the last fetched sections, regardless of tab
	Sections            []hashtagSection `json:"sections"`
	PageInfo            map[string]hashtagPageInfo
	AutoLoadMoreEnabled bool    `json:"auto_load_more_enabled"`
	MoreAvailable       bool    `json:"more_available"`
	NextID              string  `json:"next_max_id"`
	NextPage            int     `json:"next_page"`
	NextMediaIds        []int64 `json:"next_media_ids"`
	Status              string  `json:"status"`
	// contains filtered or unexported fields
}

Hashtag is used for getting the media that matches a hashtag on instagram.

func (*Hashtag) ClearError

func (h *Hashtag) ClearError()

Clears the Hashtag.err error

func (*Hashtag) Delete

func (h *Hashtag) Delete() error

Delete only a place holder, does nothing

func (*Hashtag) Error

func (h *Hashtag) Error() error

Error returns hashtag error

func (*Hashtag) GetNextID

func (h *Hashtag) GetNextID() string

func (*Hashtag) Info

func (h *Hashtag) Info() error

Info updates Hashtag information

func (*Hashtag) Latest

func (h *Hashtag) Latest() []*Item

Latest will return the last fetched items.

func (*Hashtag) Next

func (h *Hashtag) Next(p ...interface{}) bool

Next paginates over hashtag top pages.

func (*Hashtag) NextRecent

func (h *Hashtag) NextRecent() bool

NextRecent paginates over hashtag top recent pages.

func (*Hashtag) Stories

func (h *Hashtag) Stories() error

Stories returns hashtag stories.

func (*Hashtag) Sync

func (h *Hashtag) Sync() error

Sync wraps Hashtag.Info()

type IGTV

type IGTV struct {

	// Shared between the endpoints
	DestinationClientConfigs interface{} `json:"destination_client_configs"`
	MaxID                    string      `json:"max_id"`
	MoreAvailable            bool        `json:"more_available"`
	SeenState                interface{} `json:"seen_state"`
	NumResults               int         `json:"num_results"`
	Status                   string      `json:"status"`

	// Specific to igtv/discover
	Badging          interface{}   `json:"badging"`
	BannerToken      interface{}   `json:"banner_token"`
	BrowseItems      interface{}   `json:"browser_items"`
	Channels         []IGTVChannel `json:"channels"`
	Composer         interface{}   `json:"composer"`
	Items            []*Item       `json:"items"`
	DestinationItems []IGTVItem    `json:"destination_items"`
	MyChannel        struct{}      `json:"my_channel"`

	// Specific to igtv/suggested_searches
	RankToken int `json:"rank_token"`
	// contains filtered or unexported fields
}

All items with interface{} I have only seen a null response

func (*IGTV) Delete

func (igtv *IGTV) Delete() error

Delete does nothing, is only a place holder

func (*IGTV) Error

func (igtv *IGTV) Error() error

Error return the error of IGTV, if one has occured

func (*IGTV) GetNextID

func (igtv *IGTV) GetNextID() string

Error return the error of IGTV, if one has occured

func (*IGTV) Latest

func (igtv *IGTV) Latest() []*Item

Latest returns the last fetched items, by slicing IGTV.Items with IGTV.NumResults

func (*IGTV) Live

func (igtv *IGTV) Live() (*IGTVChannel, error)

Live will return a list of current broadcasts

func (*IGTV) Next

func (igtv *IGTV) Next(params ...interface{}) bool

Next allows you to paginate the IGTV Discover page.

type IGTVChannel

type IGTVChannel struct {
	ApproxTotalVideos        interface{}  `json:"approx_total_videos"`
	ApproxVideosFormatted    interface{}  `json:"approx_videos_formatted"`
	CoverPhotoUrl            string       `json:"cover_photo_url"`
	Description              string       `json:"description"`
	ID                       string       `json:"id"`
	Items                    []*Item      `json:"items"`
	NumResults               int          `json:"num_results"`
	Broadcasts               []*Broadcast `json:"live_items"`
	Title                    string       `json:"title"`
	Type                     string       `json:"type"`
	User                     *User        `json:"user_dict"`
	DestinationClientConfigs interface{}  `json:"destination_client_configs"`
	NextID                   interface{}  `json:"max_id"`
	MoreAvailable            bool         `json:"more_available"`
	SeenState                interface{}  `json:"seen_state"`
	// contains filtered or unexported fields
}

IGTVChannel can represent a single user's collection of IGTV posts, or it can

e.g. represent a user's IGTV series.

It's called a channel, however the Items inside the Channel struct can, but

don't have to, belong to the same account, depending on the request. It's a bit dubious

func (*IGTVChannel) Delete

func (igtv *IGTVChannel) Delete() error

func (*IGTVChannel) Error

func (igtv *IGTVChannel) Error() error

func (*IGTVChannel) GetNextID

func (igtv *IGTVChannel) GetNextID() string

GetNexID returns the max id used for pagination.

func (*IGTVChannel) Latest

func (igtv *IGTVChannel) Latest() []*Item

Latest will return the results from the latest fetch

func (*IGTVChannel) Live

func (igtv *IGTVChannel) Live() (*IGTVChannel, error)

Live test method to see if Live can paginate

func (*IGTVChannel) Next

func (igtv *IGTVChannel) Next(params ...interface{}) bool

Next allows you to paginate the IGTV feed of a channel. returns false when list reach the end. if FeedMedia.Error() is ErrNoMore no problems have occurred.

type IGTVItem

type IGTVItem struct {
	Title      string      `json:"title"`
	Type       string      `json:"type"`
	Channel    IGTVChannel `json:"channel"`
	Item       *Item       `json:"item"`
	LogingInfo struct {
		SourceChannelType string `json:"source_channel_type"`
	} `json:"logging_info"`

	// Specific to igtv/suggested_searches
	Hashtag interface{} `json:"hashtag"`
	Keyword interface{} `json:"keyword"`
	User    User        `json:"user"`
}

IGTVItem is a media item that can be found inside the IGTV struct, from the

IGTV Discover endpoint.

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"`
	Pending       []*Conversation `json:"pending"`

	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"`
	HasPendingTopRequests bool  `json:"has_pending_top_requests"`
	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) Error

func (inbox *Inbox) Error() error

Error will return Inbox.err

func (*Inbox) InitialSnapshot

func (inbox *Inbox) InitialSnapshot() bool

InitialSnapshot fetches the initial messages on app open, and is called

from Instagram.OpenApp() automatically.

func (*Inbox) New

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

New will send a message to a user in an existring message thread if it exists,

if not, it will create a new one. It will return the Conversation object,
for further messages you can call Conversation.Send()

func (*Inbox) Next

func (inbox *Inbox) Next() bool

Next allows pagination over message threads.

func (*Inbox) NextPending

func (inbox *Inbox) NextPending() bool

NextPending allows pagination over pending messages.

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.

func (*Inbox) SyncPending

func (inbox *Inbox) SyncPending() error

SyncPending updates inbox pending messages.

type InboxItem

type InboxItem struct {
	ID            string `json:"item_id"`
	UserID        int64  `json:"user_id"`
	Timestamp     int64  `json:"timestamp"`
	ClientContext string `json:"client_context"`
	IsShhMode     bool   `json:"is_shh_mode"`
	TqSeqID       int    `json:"tq_seq_id"`

	// Type there are a few types:
	// text, like, raven_media, action_log, media_share, reel_share, link, clip
	Type string `json:"item_type"`

	// Text is message text.
	Text string `json:"text"`

	Like string `json:"like"`

	Clip          *clip          `json:"clip"`
	Reel          *reelShare     `json:"reel_share"`
	Media         *Item          `json:"media"`
	MediaShare    *Item          `json:"media_share"`
	AnimatedMedia *AnimatedMedia `json:"animated_media"`
	VoiceMedia    *VoiceMedia    `json:"voice_media"`
	VisualMedia   *VisualMedia   `json:"visual_media"`
	ActionLog     *actionLog     `json:"action_log"`
	Link          struct {
		Text    string `json:"text"`
		Context struct {
			URL      string `json:"link_url"`
			Title    string `json:"link_title"`
			Summary  string `json:"link_summary"`
			ImageURL string `json:"link_image_url"`
		} `json:"link_context"`
	} `json:"link"`
}

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 {

	// Timeline provides access to your timeline
	Timeline *Timeline
	// Discover provides access to the discover/explore page
	Discover *Discover
	// Profiles provides methods for interaction with other user's profiles
	Profiles *Profiles
	// IGTV allows you to fetch the IGTV Discover page
	IGTV *IGTV
	// Account stores all personal data of the user and his/her options.
	Account *Account
	// Collections represents your collections with saved posts
	Collections *Collections
	// Searchbar provides methods to access IG's search functionalities
	Searchbar *Search
	// Activity are instagram notifications.
	Activity *Activity
	// Inbox provides to Instagram's message/chat system
	Inbox *Inbox
	// Feed provides access to secondary feeds such as user's and hashtag's feeds
	Feed *Feed
	// Contacts provides address book sync/unsync methods
	Contacts *Contacts
	// Locations provde feed by location ID. To find location feeds by name use Searchbar
	Locations *LocationInstance
	// Challenge stores the challenge info if provided
	Challenge *Challenge
	// Checkpoint stores the checkpoint info, this is usually a prompt to accept cookies
	Checkpoint *Checkpoint
	// TwoFactorInfo enabled 2FA
	TwoFactorInfo *TwoFactorInfo

	// Set to true to debug reponses
	Debug bool
	// contains filtered or unexported fields
}

Instagram represent the main API handler

Timeline: Represents instagram's main timeline. Profiles: Represents instagram's user profile. Account: Represents instagram's personal account. Collections: Represents instagram's saved post collections. Searchbar: Represents instagram's search. Activity: Represents instagram's user activity and notifications. Feed: Represents instagram's feed for e.g. user pages and hashtags. Contacts: Represents instagram's sync with contact book. Inbox: Represents instagram's messages. Locations: Represents instagram's locations. Challenges: Represents instagram's url challenges TwoFactorInfo Represents Instagram's 2FA login

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 EnvLoadAccs

func EnvLoadAccs(p ...string) ([]*Instagram, error)

EnvLoadAccs loads all the environment variables.

By default, the OS environment variables as well as .env are loaded To load a custom file, instead of .env, pass the filepath as an argument.

Don't Sync param is set to true to prevent any http calls on import by default

func EnvRandAcc

func EnvRandAcc(path ...string) (*Instagram, error)

EnvRandAcc will check the environment variables, and the .env file in

the current working directory (unless another path has been provided),
for either a base64 encoded goinsta config, or plain credentials.

To use this function, add one or multiple of the following:

INSTAGRAM_ACT_<name>="username:password"
INSTAGRAM_BASE64_<name>="<base64 encoded config>"

INSTAGRAM_ACT_ variables will automatiaclly be converted to INSTAGRAM_BASE64_

func Import

func Import(path string, args ...interface{}) (*Instagram, error)

Import imports instagram configuration

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

func ImportConfig

func ImportConfig(config ConfigFile, args ...interface{}) (*Instagram, error)

ImportConfig imports instagram configuration from a configuration object.

Add optional bool:true parameter to prevent account sync on import (do not make any http calls)

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

func ImportFromBase64String

func ImportFromBase64String(base64String string, args ...interface{}) (*Instagram, error)

ImportFromBase64String imports instagram configuration from a base64 encoded string.

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

func ImportFromBytes

func ImportFromBytes(inputBytes []byte, args ...interface{}) (*Instagram, error)

ImportFromBytes imports instagram configuration from an array of bytes.

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

func ImportReader

func ImportReader(r io.Reader, args ...interface{}) (*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, totp_seed ...string) *Instagram

New creates Instagram structure.

:params:

username:string
password:string
totp:string  -- OPTIONAL: 2FA private key, aka seed, used to generate 2FA codes
                checks for empty string, so it's safe to pass in an empty string.

func (*Instagram) Export

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

Export exports *Instagram object options

func (*Instagram) ExportAsBase64String

func (insta *Instagram) ExportAsBase64String() (string, error)

ExportAsBase64String exports selected *Instagram object as base64 encoded string

func (*Instagram) ExportAsBytes

func (insta *Instagram) ExportAsBytes() ([]byte, error)

ExportAsBytes exports selected *Instagram object as []byte

func (*Instagram) ExportConfig

func (insta *Instagram) ExportConfig() ConfigFile

func (*Instagram) ExportIO

func (insta *Instagram) ExportIO(writer io.Writer) error

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

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(password ...string) (err error)

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

Password can optionally be provided for re-logins. If you create the insta object with goinsta.New(), there is no need to.

Password will be deleted after login

func (*Instagram) Logout

func (insta *Instagram) Logout() error

Logout closes current session

func (*Instagram) NewBroadcast

func (insta *Instagram) NewBroadcast(id int64) *Broadcast

NewUser returns prepared user to be used with his functions.

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

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

func (*Instagram) Save

func (insta *Instagram) Save() error

Save exports config to ~/.goinsta

func (*Instagram) Search

func (insta *Instagram) Search(query string, p ...bool) (*SearchResult, error)

Search is a wrapper for insta.Searchbar.Search() Search will perform a topsearch query returning users, locations and tags,

just like the app would.

By default search behavior will be mimicked by sending a search request per

added letter, and waiting a few millis in between, just as if you were to
type anything into the search bar. However, if you only want to make one
search request passing in the full query immediately, you can turn on quick
search by passing in one bool:true parameter, like so:

Search("myquery", true)  // this will perform a quick search

func (*Instagram) SetAdID

func (insta *Instagram) SetAdID(id string)

SetAdID sets the ad id, v4 uuid | 5b23a92b-3228-4cff-b6ab-3199f531f05b

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

func (insta *Instagram) SetDebugHandler(f func(...interface{}))

func (*Instagram) SetDevice

func (insta *Instagram) SetDevice(device Device)

SetDevice allows you to set a custom device. This will also change the

user agent based on the new device.

func (*Instagram) SetDeviceID

func (insta *Instagram) SetDeviceID(id string)

SetDeviceID sets device id | android-1923fjnma8123

func (*Instagram) SetFamilyID

func (insta *Instagram) SetFamilyID(id string)

SetPhoneID sets phone family id, v4 uuid | 8b13e7b3-28f7-4e05-9474-358c6602e3f8

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

func (insta *Instagram) SetInfoHandler(f func(...interface{}))

func (*Instagram) SetPhoneID

func (insta *Instagram) SetPhoneID(id string)

SetPhoneID sets phone id, v4 uuid | fbf767a4-260a-490d-bcbb-ee7c9ed7c576

func (*Instagram) SetProxy

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

SetProxy sets proxy for connection.

func (*Instagram) SetTOTPSeed

func (insta *Instagram) SetTOTPSeed(seed string)

SetTOTPSeed will set the seed used to generate 2FA codes.

func (*Instagram) SetTimeout

func (insta *Instagram) SetTimeout(t time.Duration)

SetTimeout will set the client timeout

func (*Instagram) SetUUID

func (insta *Instagram) SetUUID(uuid string)

SetUUID sets v4 uuid | 71cd1aec-e146-4380-8d60-d216127c7b4e

func (*Instagram) SetWarnHandler

func (insta *Instagram) SetWarnHandler(f func(...interface{}))

func (*Instagram) SetWrapper

func (insta *Instagram) SetWrapper(fn ReqWrapper)

func (*Instagram) UnsetProxy

func (insta *Instagram) UnsetProxy()

UnsetProxy unsets proxy for connection.

func (*Instagram) Upload

func (insta *Instagram) Upload(o *UploadOptions) (*Item, error)

Upload is the single function used for all upload in goinsta. You can specify the options of your upload with the single parameter &UploadOptions{} See the UploadOptions struct for more details.

func (*Instagram) VisitProfile

func (insta *Instagram) VisitProfile(handle string) (*Profile, error)

VisitProfile will perform the same request sequence as if you visited a profile

in the app. It will first call Instagram.Search(user), then register the click,
and lastly visit the profile with User.VisitProfile() and gather (some) posts
from the user feed, stories, grab the friendship status, and if available IGTV posts.

You can access the profile info from the profile struct by calling Profile.Feed,

Profile.Stories, Profile.User etc. See the Profile struct for all properties.

type Item

type Item struct {
	Comments *Comments `json:"-"`

	// Post Info
	TakenAt           int64       `json:"taken_at"`
	Pk                int64       `json:"pk"`
	ID                interface{} `json:"id"` // Most of the times a string
	Index             int         // position in feed
	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"`
	User                  User    `json:"user"`
	CanReply              bool    `json:"can_reply"`
	CanReshare            bool    `json:"can_reshare"` // Used for stories
	CanViewerReshare      bool    `json:"can_viewer_reshare"`
	Caption               Caption `json:"caption"`
	CaptionIsEdited       bool    `json:"caption_is_edited"`
	LikeViewCountDisabled bool    `json:"like_and_view_counts_disabled"`
	FundraiserTag         struct {
		HasStandaloneFundraiser bool `json:"has_standalone_fundraiser"`
	} `json:"fundraiser_tag"`
	IsSeen                       bool   `json:"is_seen"`
	InventorySource              string `json:"inventory_source"`
	ProductType                  string `json:"product_type"`
	Likes                        int    `json:"like_count"`
	HasLiked                     bool   `json:"has_liked"`
	NearlyCompleteCopyRightMatch bool   `json:"nearly_complete_copyright_match"`
	// Toplikers can be `string` or `[]string`.
	// Use TopLikers function instead of getting it directly.
	Toplikers  interface{} `json:"top_likers"`
	Likers     []*User     `json:"likers"`
	PhotoOfYou bool        `json:"photo_of_you"`

	// Comments
	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"`

	// To fetch, call feed.GetCommentInfo(), or item.GetCommentInfo()
	CommentInfo *CommentInfo

	// Will always be zero, call feed.GetCommentInfo()
	CommentCount int `json:"comment_count"`

	// Previewcomments can be `string` or `[]string` or `[]Comment`.
	// Use PreviewComments function instead of getting it directly.
	Previewcomments interface{} `json:"preview_comments,omitempty"`

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

	// Carousel
	CarouselParentID string `json:"carousel_parent_id"`
	CarouselMedia    []Item `json:"carousel_media,omitempty"`

	// Live
	IsPostLive bool `json:"is_post_live"`

	// 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"`
	PlayCount         float64 `json:"play_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"`

	// IGTV
	Title                    string `json:"title"`
	IGTVExistsInViewerSeries bool   `json:"igtv_exists_in_viewer_series"`
	IGTVSeriesInfo           struct {
		HasCoverPhoto bool `json:"has_cover_photo"`
		ID            int64
		NumEpisodes   int    `json:"num_episodes"`
		Title         string `json:"title"`
	} `json:"igtv_series_info"`
	IGTVAdsInfo struct {
		AdsToggledOn            bool `json:"ads_toggled_on"`
		ElegibleForInsertingAds bool `json:"is_video_elegible_for_inserting_ads"`
	} `json:"igtv_ads_info"`

	// Ads
	IsCommercial        bool   `json:"is_commercial"`
	IsPaidPartnership   bool   `json:"is_paid_partnership"`
	CommercialityStatus string `json:"commerciality_status"`
	AdLink              string `json:"link"`
	AdLinkText          string `json:"link_text"`
	AdLinkHint          string `json:"link_hint_text"`
	AdTitle             string `json:"overlay_title"`
	AdSubtitle          string `json:"overlay_subtitle"`
	AdText              string `json:"overlay_text"`
	AdAction            string `json:"ad_action"`
	AdHeaderStyle       int    `json:"ad_header_style"`
	AdLinkType          int    `json:"ad_link_type"`
	AdMetadata          []struct {
		Type  int         `json:"type"`
		Value interface{} `json:"value"`
	} `json:"ad_metadata"`
	AndroidLinks []struct {
		AndroidClass      string `json:"androidClass"`
		CallToActionTitle string `json:"callToActionTitle"`
		DeeplinkUri       string `json:"deeplinkUri"`
		LinkType          int    `json:"linkType"`
		Package           string `json:"package"`
		WebUri            string `json:"webUri"`
	} `json:"android_links"`

	// 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"`
			StoryLinkStickers        []struct {
				X           float64 `json:"x"`
				Y           float64 `json:"y"`
				Z           int     `json:"z"`
				Width       float64 `json:"width"`
				Height      float64 `json:"height"`
				Rotation    int     `json:"rotation"`
				IsPinned    int     `json:"is_pinned"`
				IsHidden    int     `json:"is_hidden"`
				IsSticker   int     `json:"is_sticker"`
				IsFbSticker int     `json:"is_fb_sticker"`
				StoryLink   struct {
					LinkType   string `json:"link_type"`
					URL        string `json:"url"`
					LinkTitle  string `json:"link_title"`
					DisplayURL string `json:"display_url"`
				} `json:"story_link"`
			} `json:"story_link_stickers"`
		} `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 the 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) CommentCheckOffensive

func (item *Item) CommentCheckOffensive(comment string) (*CommentOffensive, error)

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() ([]byte, error)

Download will download a media item and directly return it as a byte slice. If you wish to download a picture to a folder, use item.DownloadTo(path)

func (*Item) DownloadTo

func (item *Item) DownloadTo(dst string) error
func (item *Item) Download(folder, name string) (m []byte, err error) {
	return nil, nil
}

func (*Item) GetCommentInfo

func (item *Item) GetCommentInfo() error

GetCommentInfo will fetch the item.CommentInfo for an item

func (*Item) GetID

func (item *Item) GetID() string

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

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

func (*Item) Save

func (item *Item) Save() error

Save saves media item.

You can get saved media using Account.Saved()

func (*Item) SaveTo

func (item *Item) SaveTo(c *Collection) error

Saveto allows you to save a media item to a specific collection

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     float64 `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 {
	ID               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"`
	// contains filtered or unexported fields
}

Location stores media location information.

func (*Location) Feed

func (l *Location) Feed() (*Section, error)

func (*Location) NewPostTag

func (l *Location) NewPostTag() *LocationTag

NewPostTag creates a LocationTag from a location, which can be used as a

location tag in posts.

type LocationInstance

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

func (*LocationInstance) Feeds

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

type LocationTag

type LocationTag struct {
	Name           string  `json:"name"`
	Address        string  `json:"address"`
	Lat            float64 `json:"lat"`
	Lng            float64 `json:"lng"`
	ExternalSource string  `json:"external_source"`
	PlacesID       string  `json:"facebook_places_id"`
}

LocationTag represents a post location tag

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

type NewSupporter struct {
	RepeatedSupporter bool    `json:"is_repeat_supporter"`
	SupportTier       string  `json:"support_tier"`
	Timestamp         float64 `json:"ts_secs"`
	User              struct {
		ID         int64  `json:"pk"`
		Username   string `json:"username"`
		FullName   string `json:"full_name"`
		IsPrivate  bool   `json:"is_private"`
		IsVerified bool   `json:"is_verified"`
	}
}

type PendingRequests

type PendingRequests struct {
	Users []*User `json:"users"`
	// TODO: pagination
	BigList                      bool           `json:"big_list"`
	GlobalBlacklistSample        interface{}    `json:"global_blacklist_sample"`
	NextMaxID                    string         `json:"next_max_id"`
	PageSize                     int            `json:"page_size"`
	TruncateFollowRequestAtIndex int            `json:"truncate_follow_requests_at_index"`
	Sections                     interface{}    `json:"sections"`
	SuggestedUsers               SuggestedUsers `json:"suggested_users"`
	Status                       string         `json:"status"`
}

type PicURLInfo

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

PicURLInfo repre

type Place

type Place struct {
	Title    string    `json:"title"`
	Subtitle string    `json:"subtitle"`
	Location *Location `json:"location"`
}

type Profile

type Profile struct {
	User       *User
	Friendship *Friendship

	Feed       *FeedMedia
	Stories    *StoryMedia
	Highlights []*Reel
	IGTV       *IGTVChannel
}

Profile represents an instagram user with their various properties, such as

their account info, stored in Profile.User (a *User struct), feed, stories,
Highlights, IGTV posts, and friendship status.

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 users you have blocked.

func (*Profiles) ByID

func (prof *Profiles) ByID(id_ interface{}) (*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. This is not the preffered method to fetch a profile, as the app will

not simply call this endpoint. It is better to use insta.Search(user),
or insta.Searchbar.SearchUser(user).

type RecentItems

type RecentItems struct {
	Type      int `json:"type"`
	StoryType int `json:"story_type"`
	Args      struct {
		Text     string `json:"text"`
		RichText string `json:"rich_text"`
		IconUrl  string `json:"icon_url"`
		Links    []struct {
			Start int         `json:"start"`
			End   int         `json:"end"`
			Type  string      `json:"type"`
			ID    interface{} `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"`
		AfCandidateId   int         `json:"af_candidate_id"`
		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"`
		Destination     string      `json:"destination"`
		Extra           interface{} `json:"extra"`
	} `json:"args"`
	Counts struct{} `json:"counts"`
	Pk     string   `json:"pk"`
}

type Reel

type Reel struct {
	ID                     interface{} `json:"id"`
	Items                  []*Item     `json:"items"`
	MediaCount             int         `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"`
	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"`
	FaceFilterNuxVersion int    `json:"face_filter_nux_version"`
	HasNewNuxStory       bool   `json:"has_new_nux_story"`
	User                 User   `json:"user"`
	// contains filtered or unexported fields
}

Reel represents a single user's story collection. Every user has one reel, and one reel can contain many story items

func (*Reel) Delete

func (media *Reel) Delete() error

Deletes ALL user's instagram stories. If you want to remove a single story, pick one from StoryMedia.Items, and

call Item.Delete()

See example: examples/media/deleteStories.go

func (*Reel) Sync

func (media *Reel) Sync() error

Sync function is used when Highlights 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 (fetches) StoryMedia.Items

type ReqWrapper

type ReqWrapper interface {
	GoInstaWrapper(*ReqWrapperArgs) (body []byte, h http.Header, err error)
}

type ReqWrapperArgs

type ReqWrapperArgs struct {
	Body    []byte
	Headers http.Header
	Error   error
	// contains filtered or unexported fields
}

func (*ReqWrapperArgs) GetEndpoint

func (w *ReqWrapperArgs) GetEndpoint() string

func (*ReqWrapperArgs) GetInsta

func (w *ReqWrapperArgs) GetInsta() *Instagram

func (*ReqWrapperArgs) GetWrapperCount

func (w *ReqWrapperArgs) GetWrapperCount() int

func (*ReqWrapperArgs) Ignore429

func (w *ReqWrapperArgs) Ignore429() bool

func (*ReqWrapperArgs) RetryRequest

func (w *ReqWrapperArgs) RetryRequest() (body []byte, h http.Header, err error)

func (*ReqWrapperArgs) SetInsta

func (w *ReqWrapperArgs) SetInsta(insta *Instagram)

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 information about ALL your saved posts, regardless of their collection. This is the same to vising your saved posts page, and clicking "All Posts". If you want to view a single collection, use the Collections type.

func (*SavedMedia) Delete

func (media *SavedMedia) Delete() error

Delete will unsave ALL saved items.

func (*SavedMedia) Error

func (media *SavedMedia) Error() error

Error returns the SavedMedia error

func (*SavedMedia) GetNextID

func (media *SavedMedia) GetNextID() string

ID returns the Sav

func (*SavedMedia) Next

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

Next allows pagination of "All Posts" collection

func (*SavedMedia) Sync

func (media *SavedMedia) Sync() error

Sync will fetch the initial saved items. The first call to fetch posts will always be sync, however you can also only

call SavedMedia.Next() as Sync() will automatically be called if required.

type School

type School struct{}

School is void structure (yet). Whats this even for lol

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

func (sb *Search) History() (*[]SearchHistory, error)

func (*Search) NullState

func (search *Search) NullState() error

func (*Search) Search

func (sb *Search) Search(query string, p ...bool) (*SearchResult, error)

Search will perform a topsearch query returning users, locations and tags,

just like the app would.

By default search behavior will be mimicked by sending a search request per

added letter, and waiting a few millis in between, just as if you were to
type anything into the search bar. However, if you only want to make one
search request passing in the full query immediately, you can turn on quick
search by passing in one bool:true parameter, like so:

Search("myquery", true)  // this will perform a quick search

func (*Search) SearchHashtag

func (sb *Search) SearchHashtag(query string, p ...bool) (*SearchResult, error)

SearchHashtag will perform a hashtag search with the provided query.

By default search behavior will be mimicked by sending a search request per

added letter, and waiting a few millis in between, just as if you were to
type anything into the search bar. However, if you only want to make one
search request passing in the full query immediately, you can turn on quick
search by passing in one bool:true parameter, like so:

SearchHashtag("myquery", true)  // this will perform a quick search

func (*Search) SearchLocation

func (sb *Search) SearchLocation(query string, p ...bool) (*SearchResult, error)

SearchLocation will perform a location search with the provided query.

By default search behavior will be mimicked by sending a search request per

added letter, and waiting a few millis in between, just as if you were to
type anything into the search bar. However, if you only want to make one
search request passing in the full query immediately, you can turn on quick
search by passing in one bool:true parameter, like so:

SearchLocation("myquery", true)  // this will perform a quick search

func (*Search) SearchUser

func (sb *Search) SearchUser(query string, p ...bool) (*SearchResult, error)

SearchUser will perorm a user search with the provided query.

By default search behavior will be mimicked by sending a search request per

added letter, and waiting a few millis in between, just as if you were to
type anything into the search bar. However, if you only want to make one
search request passing in the full query immediately, you can turn on quick
search by passing in one bool:true parameter, like so:

SearchUser("myquery", true)  // this will perform a quick search

type SearchFunc

type SearchFunc interface{}

type SearchHistory

type SearchHistory struct {
	Time int64 `json:"client_time"`
	User User  `json:"user"`
}

type SearchResult

type SearchResult struct {
	HasMore       bool   `json:"has_more"`
	PageToken     string `json:"page_token"`
	RankToken     string `json:"rank_token"`
	Status        string `json:"status"`
	NumResults    int64  `json:"num_results"`
	Query         string
	SearchSurface string

	// Regular Search Results
	Results []*TopSearchItem `json:"list"`
	History []SearchHistory

	// User search results
	Users []*User `json:"users"`

	// Loaction search results
	Places []Place `json:"items"`

	// Tag search results
	Tags []*Hashtag `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"`

	ClearClientCache bool `json:"clear_client_cache"`
	// contains filtered or unexported fields
}

SearchResult handles the data for the results given by each type of Search.

func (*SearchResult) Error

func (sr *SearchResult) Error() error

func (*SearchResult) Next

func (sr *SearchResult) Next() bool

func (*SearchResult) RegisterHashtagClick

func (sr *SearchResult) RegisterHashtagClick(h *Hashtag) error

RegisterHashtagClick send a register click request, and calls Hashtag.Info()

func (*SearchResult) RegisterLocationClick

func (sr *SearchResult) RegisterLocationClick(l *Location) error

RegisterLocationClick send a register click request

func (*SearchResult) RegisterUserClick

func (sr *SearchResult) RegisterUserClick(user *User) error

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"`
	NextID        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 {
	Reel       Reel         `json:"reel"`
	Broadcast  *Broadcast   `json:"broadcast"`
	Broadcasts []*Broadcast `json:"broadcasts"`
	Status     string       `json:"status"`
}

StoryMedia is the struct that handles the information from the methods to get info about Stories.

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 struct {
			ID                         interface{}   `json:"pk"`
			Username                   string        `json:"username"`
			FullName                   string        `json:"full_name"`
			IsVerified                 bool          `json:"is_verified"`
			IsPrivate                  bool          `json:"is_private"`
			HasHighlightReels          bool          `json:"has_highlight_reels"`
			HasAnonymousProfilePicture bool          `json:"has_anonymous_profile_picture"`
			ProfilePicID               string        `json:"profile_pic_id"`
			ProfilePicURL              string        `json:"profile_pic_url"`
			AccountBadges              []interface{} `json:"account_badges"`
		} `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   []string      `json:"thumbnail_urls"`
		LargeUrls       []string      `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 TOTP

type TOTP struct {
	ID   int64  `json:"totp_seed_id"`
	Seed string `json:"totp_seed"`
}

Two factor authentication seed, used to generte the one time passwords

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

	MoreAvailable         bool
	NextID                string
	NumResults            float64
	PreloadDistance       float64
	PullToRefreshWindowMs float64
	RequestID             string
	SessionID             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()

ClearPosts will unreference the current list of post items. Used when calling

.Refresh()

func (*Timeline) Delete

func (tl *Timeline) Delete() error

Delete is only a placeholder, it does nothing

func (*Timeline) Error

func (tl *Timeline) Error() error

Error will the error of the Timeline instance if one occured

func (*Timeline) FetchTray

func (tl *Timeline) FetchTray(r fetchReason) error

FetchTray fetches the timeline tray with story media. This function should rarely be called manually. If you want to refresh

the timeline call Timeline.Refresh()

func (*Timeline) GetNextID

func (tl *Timeline) GetNextID() string

func (*Timeline) NewFeedPostsExist

func (tl *Timeline) NewFeedPostsExist() (bool, error)

NewFeedPostsExist will return true if new feed posts are available.

func (*Timeline) Next

func (tl *Timeline) Next(p ...interface{}) bool

Next allows pagination after calling: User.Feed returns false when list reach the end. if Timeline.Error() is ErrNoMore no problem have been occurred. starts first request will be a cold start

func (*Timeline) Refresh

func (tl *Timeline) Refresh() error

Refresh will clear the current list of posts, perform a pull to refresh action,

and refresh the current timeline.

func (*Timeline) SetPullRefresh

func (tl *Timeline) SetPullRefresh()

SetPullRefresh will set a flag to refresh the timeline on subsequent .Next() call

func (*Timeline) Stories

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

Stories is a helper function to get the stories

func (*Timeline) UnsetPullRefresh

func (tl *Timeline) UnsetPullRefresh()

UnsetPullRefresh will unset the pull to refresh flag, if you previously manually

set it, and want to unset it.

type TopSearchItem

type TopSearchItem struct {
	Position int      `json:"position"`
	User     *User    `json:"user"`
	Hashtag  *Hashtag `json:"hashtag"`
	Place    Place    `json:"place"`
	// contains filtered or unexported fields
}

func (*TopSearchItem) RegisterClick

func (sr *TopSearchItem) RegisterClick() error

type Tray

type Tray struct {
	Stories []*Reel `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 TwoFactorInfo

type TwoFactorInfo struct {
	ID       int64  `json:"pk"`
	Username string `json:"username"`

	ElegibleForMultipleTotp    bool   `json:"elegible_for_multiple_totp"`
	ObfuscatedPhoneNr          string `json:"obfuscated_phone_number"`
	PendingTrustedNotification bool   `json:"pending_trusted_notification"`
	ShouldOptInTrustedDevice   bool   `json:"should_opt_in_trusted_device_option"`
	ShowMessengerCodeOption    bool   `json:"show_messenger_code_option"`
	ShowTrustedDeviceOption    bool   `json:"show_trusted_device_option"`
	SMSNotAllowedReason        string `json:"sms_not_allowed_reason"`
	SMSTwoFactorOn             bool   `json:"sms_two_factor_on"`
	TotpTwoFactorOn            bool   `json:"totp_two_factor_on"`
	WhatsappTwoFactorOn        bool   `json:"whatsapp_two_factor_on"`
	TwoFactorIdentifier        string `json:"two_factor_identifier"`

	PhoneVerificationSettings phoneVerificationSettings `json:"phone_verification_settings"`
	// contains filtered or unexported fields
}

func (*TwoFactorInfo) Check2FATrusted

func (info *TwoFactorInfo) Check2FATrusted() error

Check2FATrusted checks whether the device has been trusted. When you enable 2FA, you can verify, or trust, the device with one of your

other devices. This method will check if this device has been trusted.

if so, it will login, if not, it will return an error. The android app calls this method every 3 seconds

func (*TwoFactorInfo) Login2FA

func (info *TwoFactorInfo) Login2FA(in ...string) error

Login2FA allows for a login through 2FA You can either provide a code directly by passing it as a parameter, or

goinsta can generate one for you as long as the TOTP seed is set.

type UploadOptions

type UploadOptions struct {

	// File to upload, can be one of jpeg, jpg, mp4
	File io.Reader
	// Thumbnail to use for videos, one of jpeg or jpg. If not set a thumbnail
	//   will be extracted automatically
	Thumbnail io.Reader
	// Multiple images, to post a carousel or multiple stories at once
	Album []io.Reader
	// Caption text for posts
	Caption string
	// Set to true if you want to post a story
	IsStory bool
	// Option flags, set to true disable
	MuteAudio            bool
	DisableComments      bool
	DisableLikeViewCount bool
	DisableSubtitles     bool

	// Used to tag users in posts
	UserTags  *[]UserTag
	AlbumTags *[][]UserTag

	// Used to provide a location for a post
	Location *LocationTag
	// contains filtered or unexported fields
}

type User

type User struct {
	Collections *Collections

	// User info
	ID                     int64  `json:"pk"`
	Username               string `json:"username"`
	FullName               string `json:"full_name,omitempty"`
	Email                  string `json:"email,omitempty"`
	PhoneNumber            string `json:"phone_number,omitempty"`
	WhatsappNumber         string `json:"whatsapp_number,omitempty"`
	Gender                 int    `json:"gender,omitempty"`
	PublicEmail            string `json:"public_email,omitempty"`
	PublicPhoneNumber      string `json:"public_phone_number,omitempty"`
	PublicPhoneCountryCode string `json:"public_phone_country_code,omitempty"`
	ContactPhoneNumber     string `json:"contact_phone_number,omitempty"`

	// Profile visible properties
	IsPrivate                  bool   `json:"is_private"`
	IsVerified                 bool   `json:"is_verified"`
	ExternalURL                string `json:"external_url,omitempty"`
	ExternalLynxURL            string `json:"external_lynx_url,omitempty"`
	FollowerCount              int    `json:"follower_count"`
	FollowingCount             int    `json:"following_count"`
	ProfilePicID               string `json:"profile_pic_id,omitempty"`
	ProfilePicURL              string `json:"profile_pic_url,omitempty"`
	HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
	Biography                  string `json:"biography,omitempty"`
	BiographyWithEntities      struct {
		RawText  string        `json:"raw_text"`
		Entities []interface{} `json:"entities"`
	} `json:"biography_with_entities"`
	BiographyProductMentions []interface{} `json:"biography_products_mentions"`

	// Profile hidden properties
	IsNeedy                        bool          `json:"is_needy"`
	IsInterestAccount              bool          `json:"is_interest_account"`
	IsVideoCreator                 bool          `json:"is_video_creator"`
	IsBusiness                     bool          `json:"is_business"`
	BestiesCount                   int           `json:"besties_count"`
	ShowBestiesBadge               bool          `json:"show_besties_badge"`
	RecentlyBestiedByCount         int           `json:"recently_bestied_by_count"`
	AccountType                    int           `json:"account_type"`
	AccountBadges                  []interface{} `json:"account_badges,omitempty"`
	FbIdV2                         interface{}   `json:"fbid_v2"`
	IsUnpublished                  bool          `json:"is_unpublished"`
	UserTagsCount                  int           `json:"usertags_count"`
	UserTagReviewEnabled           bool          `json:"usertag_review_enabled"`
	FollowingTagCount              int           `json:"following_tag_count"`
	MutualFollowersID              []int64       `json:"profile_context_mutual_follow_ids,omitempty"`
	FollowFrictionType             int           `json:"follow_friction_type"`
	ProfileContext                 string        `json:"profile_context,omitempty"`
	HasBiographyTranslation        bool          `json:"has_biography_translation"`
	HasSavedItems                  bool          `json:"has_saved_items"`
	Nametag                        Nametag       `json:"nametag,omitempty"`
	HasChaining                    bool          `json:"has_chaining"`
	IsFavorite                     bool          `json:"is_favorite"`
	IsFavoriteForStories           bool          `json:"is_favorite_for_stories"`
	IsFavoriteForHighlights        bool          `json:"is_favorite_for_highlights"`
	IsProfileActionNeeded          bool          `json:"is_profile_action_needed"`
	CanBeReportedAsFraud           bool          `json:"can_be_reported_as_fraud"`
	CanSeeSupportInbox             bool          `json:"can_see_support_inbox"`
	CanSeeSupportInboxV1           bool          `json:"can_see_support_inbox_v1"`
	CanSeePrimaryCountryInsettings bool          `json:"can_see_primary_country_in_settings"`
	CanFollowHashtag               bool          `json:"can_follow_hashtag"`

	// Business profile properies
	CanBoostPosts                  bool   `json:"can_boost_posts"`
	CanSeeOrganicInsights          bool   `json:"can_see_organic_insights"`
	CanConvertToBusiness           bool   `json:"can_convert_to_business"`
	CanCreateSponsorTags           bool   `json:"can_create_sponsor_tags"`
	CanCreateNewFundraiser         bool   `json:"can_create_new_standalone_fundraiser"`
	CanCreateNewPersonalFundraiser bool   `json:"can_create_new_standalone_personal_fundraiser"`
	CanBeTaggedAsSponsor           bool   `json:"can_be_tagged_as_sponsor"`
	PersonalAccountAdsPageName     string `json:"personal_account_ads_page_name,omitempty"`
	PersonalAccountAdsId           string `json:"personal_account_ads_page_id,omitempty"`
	Category                       string `json:"category,omitempty"`

	// Shopping properties
	ShowShoppableFeed           bool `json:"show_shoppable_feed"`
	CanTagProductsFromMerchants bool `json:"can_tag_products_from_merchants"`

	// Miscellaneous
	IsMutedWordsGlobalEnabled bool   `json:"is_muted_words_global_enabled"`
	IsMutedWordsCustomEnabled bool   `json:"is_muted_words_custom_enabled"`
	AllowedCommenterType      string `json:"allowed_commenter_type,omitempty"`

	// Media properties
	MediaCount          int   `json:"media_count"`
	IGTVCount           int   `json:"total_igtv_videos"`
	HasIGTVSeries       bool  `json:"has_igtv_series"`
	HasVideos           bool  `json:"has_videos"`
	TotalClipCount      int   `json:"total_clips_count"`
	TotalAREffects      int   `json:"total_ar_effects"`
	GeoMediaCount       int   `json:"geo_media_count"`
	HasProfileVideoFeed bool  `json:"has_profile_video_feed"`
	LiveBroadcastID     int64 `json:"live_broadcast_id"`

	HasPlacedOrders bool `json:"has_placed_orders"`

	ShowInsightTerms           bool `json:"show_insights_terms"`
	ShowConversionEditEntry    bool `json:"show_conversion_edit_entry"`
	ShowPostsInsightEntryPoint bool `json:"show_post_insights_entry_point"`
	ShoppablePostsCount        int  `json:"shoppable_posts_count"`
	RequestContactEnabled      bool `json:"request_contact_enabled"`
	FeedPostReshareDisabled    bool `json:"feed_post_reshare_disabled"`
	CreatorShoppingInfo        struct {
		LinkedMerchantAccounts []interface{} `json:"linked_merchant_accounts,omitempty"`
	} `json:"creator_shopping_info,omitempty"`
	StandaloneFundraiserInfo struct {
		HasActiveFundraiser                 bool        `json:"has_active_fundraiser"`
		FundraiserId                        int64       `json:"fundraiser_id"`
		FundraiserTitle                     string      `json:"fundraiser_title"`
		FundraiserType                      interface{} `json:"fundraiser_type"`
		FormattedGoalAmount                 string      `json:"formatted_goal_amount"`
		BeneficiaryUsername                 string      `json:"beneficiary_username"`
		FormattedFundraiserProgressInfoText string      `json:"formatted_fundraiser_progress_info_text"`
		PercentRaised                       interface{} `json:"percent_raised"`
	} `json:"standalone_fundraiser_info"`
	AggregatePromoteEngagement   bool         `json:"aggregate_promote_engagement"`
	AllowMentionSetting          string       `json:"allow_mention_setting,omitempty"`
	AllowTagSetting              string       `json:"allow_tag_setting,omitempty"`
	LimitedInteractionsEnabled   bool         `json:"limited_interactions_enabled"`
	ReelAutoArchive              string       `json:"reel_auto_archive,omitempty"`
	HasHighlightReels            bool         `json:"has_highlight_reels"`
	HightlightReshareDisabled    bool         `json:"highlight_reshare_disabled"`
	IsMemorialized               bool         `json:"is_memorialized"`
	HasGuides                    bool         `json:"has_guides"`
	HasAffiliateShop             bool         `json:"has_active_affiliate_shop"`
	CityID                       int64        `json:"city_id"`
	CityName                     string       `json:"city_name,omitempty"`
	AddressStreet                string       `json:"address_street,omitempty"`
	DirectMessaging              string       `json:"direct_messaging,omitempty"`
	Latitude                     float64      `json:"latitude"`
	Longitude                    float64      `json:"longitude"`
	BusinessContactMethod        string       `json:"business_contact_method"`
	IncludeDirectBlacklistStatus bool         `json:"include_direct_blacklist_status"`
	HdProfilePicURLInfo          PicURLInfo   `json:"hd_profile_pic_url_info,omitempty"`
	HdProfilePicVersions         []PicURLInfo `json:"hd_profile_pic_versions,omitempty"`
	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"`
	IsPotentialBusiness          bool         `json:"is_potential_business"`
	FbPageCallToActionID         string       `json:"fb_page_call_to_action_id,omitempty"`
	FbPayExperienceEnabled       bool         `json:"fbpay_experience_enabled"`
	Zip                          string       `json:"zip,omitempty"`
	Friendship                   Friendship   `json:"friendship_status"`
	AutoExpandChaining           bool         `json:"auto_expand_chaining"`

	AllowedToCreateNonprofitFundraisers        bool          `json:"is_allowed_to_create_standalone_nonprofit_fundraisers"`
	AllowedToCreatePersonalFundraisers         bool          `json:"is_allowed_to_create_standalone_personal_fundraisers"`
	IsElegibleToShowFbCrossSharingNux          bool          `json:"is_eligible_to_show_fb_cross_sharing_nux"`
	PageIdForNewSumaBizAccount                 interface{}   `json:"page_id_for_new_suma_biz_account"`
	ElegibleShoppingSignupEntrypoints          []interface{} `json:"eligible_shopping_signup_entrypoints"`
	IsIgdProductPickerEnabled                  bool          `json:"is_igd_product_picker_enabled"`
	IsElegibleForAffiliateShopOnboarding       bool          `json:"is_eligible_for_affiliate_shop_onboarding"`
	IsElegibleForSMBSupportFlow                bool          `json:"is_eligible_for_smb_support_flow"`
	ElegibleShoppingFormats                    []interface{} `json:"eligible_shopping_formats"`
	NeedsToAcceptShoppingSellerOnboardingTerms bool          `json:"needs_to_accept_shopping_seller_onboarding_terms"`
	SellerShoppableFeedType                    string        `json:"seller_shoppable_feed_type"`
	VisibleProducts                            int           `json:"num_visible_storefront_products"`
	IsShoppingCatalogSettingsEnabled           bool          `json:"is_shopping_settings_enabled"`
	IsShoppingCommunityContentEnabled          bool          `json:"is_shopping_community_content_enabled"`
	IsShoppingAutoHighlightEnabled             bool          `json:"is_shopping_auto_highlight_eligible"`
	IsShoppingCatalogSourceSelectionEnabled    bool          `json:"is_shopping_catalog_source_selection_enabled"`
	ProfessionalConversionSuggestedAccountType int           `json:"professional_conversion_suggested_account_type"`
	InteropMessagingUserfbid                   int64         `json:"interop_messaging_user_fbid"`
	LinkedFbInfo                               struct{}      `json:"linked_fb_info"`
	HasElegibleWhatsappLinkingCategory         struct{}      `json:"has_eligible_whatsapp_linking_category"`
	ExistingUserAgeCollectionEnabled           bool          `json:"existing_user_age_collection_enabled"`
	AboutYourAccountBloksEntrypointEnabled     bool          `json:"about_your_account_bloks_entrypoint_enabled"`
	OpenExternalUrlWithInAppBrowser            bool          `json:"open_external_url_with_in_app_browser"`
	MerchantCheckoutStyle                      string        `json:"merchant_checkout_style"`

	// Profile picture as raw bytes, to populate call User.DownloadProfilePic()
	ProfilePic []byte
	// contains filtered or unexported fields
}

User is the representation of instagram's user profile

func (*User) ApprovePending

func (user *User) ApprovePending() error

func (*User) Block

func (user *User) Block(autoBlock bool) error

Block blocks user

This function updates current User.Friendship structure. Param: autoBlock - automatically block accounts registered on the same email/number

See example: examples/user/block.go

func (*User) DownloadProfilePic

func (user *User) DownloadProfilePic() ([]byte, error)

DownloadProfilePic will download a user's profile picture if available, and

return it as a byte slice.

func (*User) DownloadProfilePicTo

func (user *User) DownloadProfilePicTo(dst string) error

DownloadProfilePicTo will download the user profile picture to the provided

path. If path does not include a file name, one will be extracted automatically.

File extention does not need to be set, and will be set automatically.

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(query string) *Users

Followers returns a list of user followers.

Query can be used to search for a specific user. Be aware that it only matches from the start, e.g. "theprimeagen" will only match "theprime" not "prime". To fetch all user an empty string "".

Users.Next can be used to paginate

func (*User) Following

func (user *User) Following(query string, order FollowOrder) *Users

Following returns a list of user following.

Query can be used to search for a specific user. Be aware that it only matches from the start, e.g. "theprimeagen" will only match "theprime" not "prime". To fetch all user an empty string "".

Users.Next can be used to paginate

func (*User) GetFeaturedAccounts

func (user *User) GetFeaturedAccounts() ([]*User, error)

GetFeaturedAccounts will call the featured accounts enpoint.

func (*User) GetFriendship

func (user *User) GetFriendship() (fr *Friendship, err error)

GetFriendship allows user to get friend relationship.

The result is stored in user.Friendship

func (*User) Highlights

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

Highlights will fetch a user's highlights.

func (*User) IGTV

func (user *User) IGTV() (*IGTVChannel, error)

IGTV returns the IGTV items of a user

Use IGTVChannel.Next for pagination.

func (*User) IGTVSeries

func (user *User) IGTVSeries() ([]*IGTVChannel, error)

IGTVSeries will fetch the igtv series of a user. Usually the slice length

of the return value is 1, as there is one channel, which contains multiple
series.

func (*User) IgnorePending

func (user *User) IgnorePending() error

func (*User) Info

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

Info updates user info extra query arguments can be passes one after another as func(key, value). Only if an even number of string arguements will be passed, they will be

used in the query.

See example: examples/user/friendship.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, error)

Stories will fetch a user's stories.

func (*User) Sync

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

Sync wraps User.Info() 1:1

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.

func (*User) VisitProfile

func (user *User) VisitProfile() (*Profile, error)

VisitProfile will perform the same request sequence as if you visited a profile

in the app. Thus it will gather (some) posts from the user feed, stories,
grab the friendship status, and if available IGTV posts.

You can access the profile info from the profile struct by calling Profile.Feed,

Profile.Stories, Profile.User etc. See the Profile struct for all properties.

This method will visit a profile directly from an already existing User instance. To visit a profile without the User struct, you can use Insta.VisitProfile(user),

which will perform a search, register the click, and call this method.

type UserTag

type UserTag struct {
	User     *User      `json:"user_id"`
	Position [2]float64 `json:"position"`
}

UserTag represents a user post tag. Position is optional, a random

position will be used if not provided. For videos the position will always
be [0,0], and doesn't need to be provided.

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

type VisualMedia

type VisualMedia struct {
	Media                      *Item `json:"media"`
	ExpiringMediaActionSummary struct {
		Type      string `json:"type"`
		Timestamp int64  `json:"timestamp"`
		Count     int    `json:"count"`
	} `json:"expiring_media_action_summary"`
	SeenUserIds        []string `json:"seen_user_ids"`
	ViewMode           string   `json:"view_mode"`
	SeenCount          int      `json:"seen_count"`
	ReplayExpiringAtUs int64    `json:"replay_expiring_at_us"`
}

used for raven_media type

type VoiceMedia

type VoiceMedia struct {
	Media struct {
		ID          string `json:"id"`
		MediaType   int    `json:"media_type"`
		ProductType string `json:"product_type"`
		Audio       struct {
			AudioSrc                    string    `json:"audio_src"`
			Duration                    int       `json:"duration"`
			WaveformData                []float64 `json:"waveform_data"`
			WaveformSamplingFrequencyHz int       `json:"waveform_sampling_frequency_hz"`
		} `json:"audio"`
		OrganicTrackingToken string `json:"organic_tracking_token"`
		User                 *User  `json:"user"`
	} `json:"media"`
	IsShhMode          bool    `json:"is_shh_mode"`
	SeenUserIds        []int64 `json:"seen_user_ids"`
	ViewMode           string  `json:"view_mode"`
	SeenCount          int     `json:"seen_count"`
	ReplayExpiringAtUs int64   `json:"replay_expiring_at_us"`
}

type Wrapper

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

func DefaultWrapper

func DefaultWrapper() *Wrapper

func (*Wrapper) GoInstaWrapper

func (w *Wrapper) GoInstaWrapper(o *ReqWrapperArgs) ([]byte, http.Header, error)

GoInstaWrapper is a warpper function for goinsta

Directories

Path Synopsis
cmds
refreshTestAccounts
Use this program to parse instagram accounts from goinsta/tests/.env, and
Use this program to parse instagram accounts from goinsta/tests/.env, and

Jump to

Keyboard shortcuts

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