goinsta

package module
v0.0.0-...-b95c0ba Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 28 Imported by: 0

README

Golang + Instagram Private API

Unofficial Instagram API for Golang

Build Status GoDoc Go Report Card Gitter chat

Features

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

Package installation

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

Example

package main

import (
	"fmt"

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

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

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

  ...
}

Projects using goinsta

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Instagram or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk.

Versioning

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

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

Or

If you have GO111MODULE=on

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

Donate

Ahmdrz

btc Bitcoin: 1KjcfrBPJtM4MfBSGTqpC6RcoEW1KBh15X

Mester

btc Bitcoin: 37aogDJYBFkdSJTWG7TgcpgNweGHPCy1Ks

Analytics

Documentation

Index

Constants

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

Variables

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

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

Functions

func Export

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

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

func GetBest

func GetBest(obj interface{}) string

GetBest returns best quality image or video.

Arguments can be []Video or []Candidate

func MediaIDFromShortID

func MediaIDFromShortID(code string) (string, error)

Types

type Account

type Account struct {
	ID                         int64        `json:"pk"`
	Username                   string       `json:"username"`
	FullName                   string       `json:"full_name"`
	Biography                  string       `json:"biography"`
	ProfilePicURL              string       `json:"profile_pic_url"`
	Email                      string       `json:"email"`
	PhoneNumber                string       `json:"phone_number"`
	IsBusiness                 bool         `json:"is_business"`
	Gender                     int          `json:"gender"`
	ProfilePicID               string       `json:"profile_pic_id"`
	CanSeeOrganicInsights      bool         `json:"can_see_organic_insights"`
	ShowInsightsTerms          bool         `json:"show_insights_terms"`
	Nametag                    Nametag      `json:"nametag"`
	HasAnonymousProfilePicture bool         `json:"has_anonymous_profile_picture"`
	IsPrivate                  bool         `json:"is_private"`
	IsUnpublished              bool         `json:"is_unpublished"`
	AllowedCommenterType       string       `json:"allowed_commenter_type"`
	IsVerified                 bool         `json:"is_verified"`
	MediaCount                 int          `json:"media_count"`
	FollowerCount              int          `json:"follower_count"`
	FollowingCount             int          `json:"following_count"`
	GeoMediaCount              int          `json:"geo_media_count"`
	ExternalURL                string       `json:"external_url"`
	HasBiographyTranslation    bool         `json:"has_biography_translation"`
	ExternalLynxURL            string       `json:"external_lynx_url"`
	HdProfilePicURLInfo        PicURLInfo   `json:"hd_profile_pic_url_info"`
	HdProfilePicVersions       []PicURLInfo `json:"hd_profile_pic_versions"`
	UsertagsCount              int          `json:"usertags_count"`
	HasChaining                bool         `json:"has_chaining"`
	ReelAutoArchive            string       `json:"reel_auto_archive"`
	PublicEmail                string       `json:"public_email"`
	PublicPhoneNumber          string       `json:"public_phone_number"`
	PublicPhoneCountryCode     string       `json:"public_phone_country_code"`
	ContactPhoneNumber         string       `json:"contact_phone_number"`
	Byline                     string       `json:"byline"`
	SocialContext              string       `json:"social_context,omitempty"`
	SearchSocialContext        string       `json:"search_social_context,omitempty"`
	MutualFollowersCount       float64      `json:"mutual_followers_count"`
	LatestReelMedia            int64        `json:"latest_reel_media,omitempty"`
	CityID                     int64        `json:"city_id"`
	CityName                   string       `json:"city_name"`
	AddressStreet              string       `json:"address_street"`
	DirectMessaging            string       `json:"direct_messaging"`
	Latitude                   float64      `json:"latitude"`
	Longitude                  float64      `json:"longitude"`
	Category                   string       `json:"category"`
	BusinessContactMethod      string       `json:"business_contact_method"`
	IsCallToActionEnabled      bool         `json:"is_call_to_action_enabled"`
	FbPageCallToActionID       string       `json:"fb_page_call_to_action_id"`
	Zip                        string       `json:"zip"`
	AllowContactsSync          bool         `json:"allow_contacts_sync"`
	CanBoostPost               bool         `json:"can_boost_post"`
	// contains filtered or unexported fields
}

Account is personal account object

See examples: examples/account/*

func (*Account) Archived

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

Archived returns current account archive feed

For pagination use FeedMedia.Next()

func (*Account) ChangePassword

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

ChangePassword changes current password.

GoInsta does not store current instagram password (for security reasons) If you want to change your password you must parse old and new password.

See example: examples/account/changePass.go

func (*Account) Feed

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

Feed returns current account feed

params can be:
	string: timestamp of the minimum media timestamp.

minTime is the minimum timestamp of media.

For pagination use FeedMedia.Next()

func (*Account) Followers

func (account *Account) Followers() *Users

Followers returns a list of user followers.

Users.Next can be used to paginate

See example: examples/account/followers.go

func (*Account) Following

func (account *Account) Following() *Users

Following returns a list of user following.

Users.Next can be used to paginate

See example: examples/account/following.go

func (*Account) Liked

func (account *Account) Liked() *FeedMedia

Liked are liked publications

func (*Account) PendingFollowRequests

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

PendingFollowRequests returns pending follow requests.

func (*Account) RemoveProfilePic

func (account *Account) RemoveProfilePic() error

RemoveProfilePic removes current profile picture

This function updates current Account information.

See example: examples/account/removeProfilePic.go

func (*Account) Saved

func (account *Account) Saved() (*SavedMedia, error)

Saved returns saved media.

func (*Account) SetBiography

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

SetBiography changes your Instagram's biography.

This function updates current Account information.

func (*Account) SetPrivate

func (account *Account) SetPrivate() error

SetPrivate sets account to private mode.

This function updates current Account information.

See example: examples/account/setPrivate.go

func (*Account) SetPublic

func (account *Account) SetPublic() error

SetPublic sets account to public mode.

This function updates current Account information.

See example: examples/account/setPublic.go

func (*Account) Stories

func (account *Account) Stories() *StoryMedia

Stories returns account stories.

Use StoryMedia.Next for pagination.

See example: examples/account/stories.go

func (*Account) Sync

func (account *Account) Sync() error

Sync updates account information

func (*Account) Tags

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

Tags returns media where account is tagged in

For pagination use FeedMedia.Next()

type Activity

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

Activity is the activity of your instagram account

You can get Recent and Following activities.

func (*Activity) Following

func (act *Activity) Following() *FollowingActivity

Following allows to receive recent following activity.

Use Next to paginate over activities

See example: examples/activity/following.go

func (*Activity) Recent

func (act *Activity) Recent() *MineActivity

Recent allows to receive recent activity (notifications).

Use Activities.Next to paginate over activities.

See example: examples/activity/recent.go

type BlockedUser

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 {
	ID                   int64  `json:"id"`
	BroadcastStatus      string `json:"broadcast_status"`
	DashManifest         string `json:"dash_manifest"`
	ExpireAt             int64  `json:"expire_at"`
	EncodingTag          string `json:"encoding_tag"`
	InternalOnly         bool   `json:"internal_only"`
	NumberOfQualities    int    `json:"number_of_qualities"`
	CoverFrameURL        string `json:"cover_frame_url"`
	BroadcastOwner       User   `json:"broadcast_owner"`
	PublishedTime        int64  `json:"published_time"`
	MediaID              string `json:"media_id"`
	BroadcastMessage     string `json:"broadcast_message"`
	OrganicTrackingToken string `json:"organic_tracking_token"`
}

Broadcast is live videos.

type Candidate

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

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

type Caption

type Caption struct {
	ID              int64  `json:"pk"`
	UserID          int64  `json:"user_id"`
	Text            string `json:"text"`
	Type            int    `json:"type"`
	CreatedAt       int64  `json:"created_at"`
	CreatedAtUtc    int64  `json:"created_at_utc"`
	ContentType     string `json:"content_type"`
	Status          string `json:"status"`
	BitFlags        int    `json:"bit_flags"`
	User            User   `json:"user"`
	DidReportAsSpam bool   `json:"did_report_as_spam"`
	MediaID         int64  `json:"media_id"`
	HasTranslation  bool   `json:"has_translation"`
}

Caption is media caption

type Challenge

type Challenge struct {
	StepName     string            `json:"step_name"`
	StepData     ChallengeStepData `json:"step_data"`
	LoggedInUser *Account          `json:"logged_in_user,omitempty"`
	UserID       int64             `json:"user_id"`
	NonceCode    string            `json:"nonce_code"`
	Action       string            `json:"action"`
	Status       string            `json:"status"`
	// contains filtered or unexported fields
}

func (*Challenge) Process

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

func (*Challenge) SendSecurityCode

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

sendSecurityCode sends the code received in the message

type ChallengeError

type ChallengeError struct {
	Message   string `json:"message"`
	Challenge struct {
		URL               string `json:"url"`
		APIPath           string `json:"api_path"`
		HideWebviewHeader bool   `json:"hide_webview_header"`
		Lock              bool   `json:"lock"`
		Logout            bool   `json:"logout"`
		NativeFlow        bool   `json:"native_flow"`
	} `json:"challenge"`
	Status    string `json:"status"`
	ErrorType string `json:"error_type"`
}

ChallengeError is error returned by HTTP 400 status code.

func (ChallengeError) Error

func (e ChallengeError) Error() string

type ChallengeStepData

type ChallengeStepData struct {
	Choice           string      `json:"choice"`
	FbAccessToken    string      `json:"fb_access_token"`
	BigBlueToken     string      `json:"big_blue_token"`
	GoogleOauthToken string      `json:"google_oauth_token"`
	Email            string      `json:"email"`
	SecurityCode     string      `json:"security_code"`
	ResendDelay      interface{} `json:"resend_delay"`
	ContactPoint     string      `json:"contact_point"`
	FormType         string      `json:"form_type"`
}

type Comment

type Comment struct {
	ID                             int64     `json:"pk"`
	Text                           string    `json:"text"`
	Type                           int       `json:"type"`
	User                           User      `json:"user"`
	UserID                         int64     `json:"user_id"`
	BitFlags                       int       `json:"bit_flags"`
	ChildCommentCount              int       `json:"child_comment_count"`
	CommentIndex                   int       `json:"comment_index"`
	CommentLikeCount               int       `json:"comment_like_count"`
	ContentType                    string    `json:"content_type"`
	CreatedAt                      int64     `json:"created_at"`
	CreatedAtUtc                   int64     `json:"created_at_utc"`
	DidReportAsSpam                bool      `json:"did_report_as_spam"`
	HasLikedComment                bool      `json:"has_liked_comment"`
	InlineComposerDisplayCondition string    `json:"inline_composer_display_condition"`
	OtherPreviewUsers              []User    `json:"other_preview_users"`
	PreviewChildComments           []Comment `json:"preview_child_comments"`
	NextMaxChildCursor             string    `json:"next_max_child_cursor,omitempty"`
	HasMoreTailChildComments       bool      `json:"has_more_tail_child_comments,omitempty"`
	NextMinChildCursor             string    `json:"next_min_child_cursor,omitempty"`
	HasMoreHeadChildComments       bool      `json:"has_more_head_child_comments,omitempty"`
	NumTailChildComments           int       `json:"num_tail_child_comments,omitempty"`
	NumHeadChildComments           int       `json:"num_head_child_comments,omitempty"`
	Status                         string    `json:"status"`
	// contains filtered or unexported fields
}

Comment is a type of Media retrieved by the Comments methods

func (*Comment) Like

func (c *Comment) Like() error

Like likes comment.

func (*Comment) Unlike

func (c *Comment) Unlike() error

Unlike unlikes comment.

type Comments

type Comments struct {
	Items                          []Comment       `json:"comments"`
	CommentCount                   int64           `json:"comment_count"`
	Caption                        Caption         `json:"caption"`
	CaptionIsEdited                bool            `json:"caption_is_edited"`
	HasMoreComments                bool            `json:"has_more_comments"`
	HasMoreHeadloadComments        bool            `json:"has_more_headload_comments"`
	ThreadingEnabled               bool            `json:"threading_enabled"`
	MediaHeaderDisplay             string          `json:"media_header_display"`
	InitiateAtTop                  bool            `json:"initiate_at_top"`
	InsertNewCommentToTop          bool            `json:"insert_new_comment_to_top"`
	PreviewComments                []Comment       `json:"preview_comments"`
	NextMaxID                      json.RawMessage `json:"next_max_id,omitempty"`
	NextMinID                      json.RawMessage `json:"next_min_id,omitempty"`
	CommentLikesEnabled            bool            `json:"comment_likes_enabled"`
	DisplayRealtimeTypingIndicator bool            `json:"display_realtime_typing_indicator"`
	Status                         string          `json:"status"`
	// contains filtered or unexported fields
}

Comments allows user to interact with media (item) comments. You can Add or Delete by index or by user name.

func (*Comments) Add

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

Add push a comment in media.

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

See example: examples/media/commentsAdd.go

func (*Comments) Del

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

Del deletes comment.

func (*Comments) DelByID

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

DelByID removes comment using id.

See example: examples/media/commentsDelByID.go

func (*Comments) DelMine

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

DelMine removes all of your comments limited by parsed parameter.

If limit is <= 0 DelMine will delete all your comments.

See example: examples/media/commentsDelMine.go

func (*Comments) Disable

func (comments *Comments) Disable() error

Disable disables comments in FeedMedia.

See example: examples/media/commentDisable.go

func (*Comments) Enable

func (comments *Comments) Enable() error

Enable enables comments in FeedMedia

See example: examples/media/commentEnable.go

func (Comments) Error

func (comments Comments) Error() error

func (*Comments) Next

func (comments *Comments) Next() bool

Next allows comment pagination.

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

New comments are stored in Comments.Items

func (*Comments) Sync

func (comments *Comments) Sync()

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

See example: examples/media/commentsSync.go

type ConfigFile

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

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

type Contact

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

type Contacts

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

func (*Contacts) SyncContacts

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

func (*Contacts) UnlinkContacts

func (c *Contacts) UnlinkContacts() error

type Conversation

type Conversation struct {
	ID   string `json:"thread_id"`
	V2ID string `json:"thread_v2_id"`
	// Items can be of many types.
	Items                     []InboxItem `json:"items"`
	Title                     string      `json:"thread_title"`
	Users                     []User      `json:"users"`
	LeftUsers                 []User      `json:"left_users"`
	Pending                   bool        `json:"pending"`
	PendingScore              int64       `json:"pending_score"`
	ReshareReceiveCount       int         `json:"reshare_receive_count"`
	ReshareSendCount          int         `json:"reshare_send_count"`
	ViewerID                  int64       `json:"viewer_id"`
	ValuedRequest             bool        `json:"valued_request"`
	LastActivityAt            int64       `json:"last_activity_at"`
	Muted                     bool        `json:"muted"`
	IsPin                     bool        `json:"is_pin"`
	Named                     bool        `json:"named"`
	ThreadType                string      `json:"thread_type"`
	ExpiringMediaSendCount    int         `json:"expiring_media_send_count"`
	ExpiringMediaReceiveCount int         `json:"expiring_media_receive_count"`
	Inviter                   User        `json:"inviter"`
	HasOlder                  bool        `json:"has_older"`
	HasNewer                  bool        `json:"has_newer"`
	LastSeenAt                map[string]struct {
		Timestamp string `json:"timestamp"`
		ItemID    string `json:"item_id"`
	} `json:"last_seen_at"`
	NewestCursor      string `json:"newest_cursor"`
	OldestCursor      string `json:"oldest_cursor"`
	IsSpam            bool   `json:"is_spam"`
	LastPermanentItem Item   `json:"last_permanent_item"`
	// contains filtered or unexported fields
}

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

func (Conversation) Error

func (c Conversation) Error() error

func (*Conversation) Like

func (c *Conversation) Like() error

Like sends heart to the conversation

See example: examples/media/likeAll.go

func (*Conversation) Next

func (c *Conversation) Next() bool

Next loads next set of private messages.

See example: examples/inbox/conversation.go

func (*Conversation) Send

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

Send sends message in conversation

See example: examples/inbox/sms.go

func (*Conversation) Write

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

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

type ErrChallengeProcess

type ErrChallengeProcess struct {
	StepName string
}

func (ErrChallengeProcess) Error

func (ec ErrChallengeProcess) Error() string

type Error400

type Error400 struct {
	ChallengeError
	Action     string `json:"action"`
	StatusCode string `json:"status_code"`
	Payload    struct {
		ClientContext string `json:"client_context"`
		Message       string `json:"message"`
	} `json:"payload"`
	Status string `json:"status"`
}

Error400 is error returned by HTTP 400 status code.

func (Error400) Error

func (e Error400) Error() string

type Error503

type Error503 struct {
	Message string
}

Error503 is instagram API error

func (Error503) Error

func (e Error503) Error() string

type ErrorN

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

ErrorN is general instagram error

func (ErrorN) Error

func (e ErrorN) Error() string

type Feed

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

Feed is the object for all feed endpoints.

func (*Feed) LocationID

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

Feed search by locationID

func (*Feed) Tags

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

Tags search by Tag in user Feed

(sorry for returning FeedTag. See #FeedTag)

type FeedLocation

type FeedLocation struct {
	RankedItems         []Item   `json:"ranked_items"`
	Items               []Item   `json:"items"`
	NumResults          int      `json:"num_results"`
	NextID              string   `json:"next_max_id"`
	MoreAvailable       bool     `json:"more_available"`
	AutoLoadMoreEnabled bool     `json:"auto_load_more_enabled"`
	MediaCount          int      `json:"media_count"`
	Location            Location `json:"location"`
	Status              string   `json:"status"`
}

FeedLocation is the struct that fits the structure returned by instagram on LocationID search.

type FeedMedia

type FeedMedia struct {
	Items               []Item `json:"items"`
	NumResults          int    `json:"num_results"`
	MoreAvailable       bool   `json:"more_available"`
	AutoLoadMoreEnabled bool   `json:"auto_load_more_enabled"`
	Status              string `json:"status"`
	// Can be int64 and string
	// this is why we recommend Next() usage :')
	NextID interface{} `json:"next_max_id"`
	// contains filtered or unexported fields
}

FeedMedia represent a set of media items

func (*FeedMedia) Delete

func (media *FeedMedia) Delete() error

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

See example: examples/media/mediaDelete.go

func (FeedMedia) Error

func (media FeedMedia) Error() error

func (*FeedMedia) ID

func (media *FeedMedia) ID() string

ID returns media id.

func (*FeedMedia) Next

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

Next allows pagination after calling: User.Feed Params: ranked_content is set to "true" by default, you can set it to false by either passing "false" or false as parameter. returns false when list reach the end. if FeedMedia.Error() is ErrNoMore no problem have been occurred.

func (*FeedMedia) SetID

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

SetID sets media ID this value can be int64 or string

func (*FeedMedia) SetInstagram

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

SetInstagram set instagram

func (*FeedMedia) Sync

func (media *FeedMedia) Sync() error

Sync updates media values.

type FeedTag

type FeedTag struct {
	RankedItems         []Item     `json:"ranked_items"`
	Images              []Item     `json:"items"`
	NumResults          int        `json:"num_results"`
	NextID              string     `json:"next_max_id"`
	MoreAvailable       bool       `json:"more_available"`
	AutoLoadMoreEnabled bool       `json:"auto_load_more_enabled"`
	Story               StoryMedia `json:"story"`
	Status              string     `json:"status"`
	// contains filtered or unexported fields
}

FeedTag is the struct that fits the structure returned by instagram on TagSearch.

func (*FeedTag) Error

func (ft *FeedTag) Error() error

Error returns hashtag error

func (*FeedTag) Next

func (ft *FeedTag) Next() bool

Next paginates over hashtag feed.

type FollowingActivity

type FollowingActivity struct {
	AutoLoadMoreEnabled bool  `json:"auto_load_more_enabled"`
	NextID              int64 `json:"next_max_id"`
	Stories             []struct {
		Type      int `json:"type"`
		StoryType int `json:"story_type"`
		Args      struct {
			MediaDestination string `json:"media_destination"`
			Destination      string `json:"destination"`
			Text             string `json:"text"`
			Links            []struct {
				Start int    `json:"start"`
				End   int    `json:"end"`
				Type  string `json:"type"`
				ID    string `json:"id"`
			} `json:"links"`
			ProfileID               int64  `json:"profile_id"`
			ProfileImage            string `json:"profile_image"`
			SecondProfileID         int64  `json:"second_profile_id"`
			SecondProfileImage      string `json:"second_profile_image"`
			ProfileImageDestination string `json:"profile_image_destination"`
			Media                   []struct {
				ID    string `json:"id"`
				Image string `json:"image"`
			} `json:"media"`
			Timestamp int64  `json:"timestamp"`
			Tuuid     string `json:"tuuid"`
		} `json:"args"`
		Counts struct {
		} `json:"counts"`
		Pk string `json:"pk"`
	} `json:"stories"`
	Status string `json:"status"`
	// contains filtered or unexported fields
}

FollowingActivity is the latest activity of the people you are following

func (*FollowingActivity) Error

func (act *FollowingActivity) Error() error

func (*FollowingActivity) Next

func (act *FollowingActivity) Next() bool

Next allows pagination over following recent activity.

See example:

type Friendship

type Friendship struct {
	IncomingRequest bool `json:"incoming_request"`
	FollowedBy      bool `json:"followed_by"`
	OutgoingRequest bool `json:"outgoing_request"`
	Following       bool `json:"following"`
	Blocking        bool `json:"blocking"`
	IsPrivate       bool `json:"is_private"`
	Muting          bool `json:"muting"`
	IsMutingReel    bool `json:"is_muting_reel"`
}

Friendship stores the details of the relationship between two users.

type Hashtag

type Hashtag struct {
	Name string `json:"name"`

	Sections []struct {
		LayoutType    string `json:"layout_type"`
		LayoutContent struct {
			// F*ck you instagram.
			// Why you do this f*cking horribly structure?!?
			// Media []Media IS EASY. CHECK IT!
			Medias []struct {
				Item Item `json:"media"`
			} `json:"medias"`
		} `json:"layout_content"`
		FeedType        string `json:"feed_type"`
		ExploreItemInfo struct {
			NumColumns      int     `json:"num_columns"`
			TotalNumColumns int     `json:"total_num_columns"`
			AspectRatio     float32 `json:"aspect_ratio"`
			Autoplay        bool    `json:"autoplay"`
		} `json:"explore_item_info"`
	} `json:"sections"`
	MediaCount          int     `json:"media_count"`
	ID                  int64   `json:"id"`
	MoreAvailable       bool    `json:"more_available"`
	NextID              string  `json:"next_max_id"`
	NextPage            int     `json:"next_page"`
	NextMediaIds        []int64 `json:"next_media_ids"`
	AutoLoadMoreEnabled bool    `json:"auto_load_more_enabled"`
	Status              string  `json:"status"`
	// contains filtered or unexported fields
}

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

func (*Hashtag) Error

func (h *Hashtag) Error() error

Error returns hashtag error

func (*Hashtag) Next

func (h *Hashtag) Next() bool

Next paginates over hashtag pages (xd).

func (*Hashtag) Stories

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

Stories returns hashtag stories.

func (*Hashtag) Sync

func (h *Hashtag) Sync() error

Sync updates Hashtag information preparing it to Next call.

type Images

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

Images are different quality images

func (Images) GetBest

func (img Images) GetBest() string

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

type Inbox

type Inbox struct {
	Conversations []Conversation `json:"threads"`

	HasNewer            bool   `json:"has_newer"` // TODO
	HasOlder            bool   `json:"has_older"`
	Cursor              string `json:"oldest_cursor"`
	UnseenCount         int    `json:"unseen_count"`
	UnseenCountTs       int64  `json:"unseen_count_ts"`
	BlendedInboxEnabled bool   `json:"blended_inbox_enabled"`
	// this fields are copied from response
	SeqID                int64 `json:"seq_id"`
	PendingRequestsTotal int   `json:"pending_requests_total"`
	SnapshotAtMs         int64 `json:"snapshot_at_ms"`
	// contains filtered or unexported fields
}

Inbox is the direct message inbox.

Inbox contains Conversations. Each conversation has InboxItems. InboxItems are the message of the chat.

func (*Inbox) New

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

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

See example: examples/inbox/newconversation.go

func (*Inbox) Next

func (inbox *Inbox) Next() bool

Next allows pagination over messages.

See example: examples/inbox/next.go

func (*Inbox) NextPending

func (inbox *Inbox) NextPending() bool

NextPending allows pagination over pending messages.

See example: examples/inbox/next.go

func (*Inbox) Reset

func (inbox *Inbox) Reset()

Reset sets inbox cursor at the beginning.

func (*Inbox) Sync

func (inbox *Inbox) Sync() error

Sync updates inbox messages.

See example: examples/inbox/sync.go

func (*Inbox) SyncPending

func (inbox *Inbox) SyncPending() error

SyncPending updates inbox pending messages.

See example: examples/inbox/sync.go

type InboxItem

type InboxItem struct {
	ID            string `json:"item_id"`
	UserID        int64  `json:"user_id"`
	Timestamp     int64  `json:"timestamp"`
	ClientContext string `json:"client_context"`

	// Type there are a few types:
	// text, like, raven_media
	Type string `json:"item_type"`

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

	Like string `json:"like"`

	// Media is image or video
	Media struct {
		ID                   int64  `json:"id"`
		Images               Images `json:"image_versions2"`
		OriginalWidth        int    `json:"original_width"`
		OriginalHeight       int    `json:"original_height"`
		MediaType            int    `json:"media_type"`
		MediaID              int64  `json:"media_id"`
		PlaybackDurationSecs int    `json:"playback_duration_secs"`
		URLExpireAtSecs      int    `json:"url_expire_at_secs"`
		OrganicTrackingToken string `json:"organic_tracking_token"`
	}
}

InboxItem is any conversation message.

type InboxItemLike

type InboxItemLike struct {
	ItemID    string `json:"item_id"`
	ItemType  string `json:"item_type"`
	Timestamp int64  `json:"timestamp"`
	UserID    int64  `json:"user_id"`
}

InboxItemLike is the heart sent during a conversation.

type InboxItemMedia

type InboxItemMedia struct {
	ClientContext              string `json:"client_context"`
	ExpiringMediaActionSummary struct {
		Count     int    `json:"count"`
		Timestamp int64  `json:"timestamp"`
		Type      string `json:"type"`
	} `json:"expiring_media_action_summary"`
	ItemID     string `json:"item_id"`
	ItemType   string `json:"item_type"`
	RavenMedia struct {
		MediaType int64 `json:"media_type"`
	} `json:"raven_media"`
	ReplyChainCount int           `json:"reply_chain_count"`
	SeenUserIds     []interface{} `json:"seen_user_ids"`
	Timestamp       int64         `json:"timestamp"`
	UserID          int64         `json:"user_id"`
	ViewMode        string        `json:"view_mode"`
}

InboxItemMedia is inbox media item

type Instagram

type Instagram struct {

	// Challenge controls security side of account (Like sms verify / It was me)
	Challenge *Challenge
	// Profiles is the user interaction
	Profiles *Profiles
	// Account stores all personal data of the user and his/her options.
	Account *Account
	// Search performs searching of multiple things (users, locations...)
	Search *Search
	// Timeline allows to receive timeline media.
	Timeline *Timeline
	// Activity are instagram notifications.
	Activity *Activity
	// Inbox are instagram message/chat system.
	Inbox *Inbox
	// Feed for search over feeds
	Feed *Feed
	// User contacts from mobile address book
	Contacts *Contacts
	// Location instance
	Locations *LocationInstance
	// contains filtered or unexported fields
}

Instagram represent the main API handler

Profiles: Represents instragram's user profile. Account: Represents instagram's personal account. Search: Represents instagram's search. Timeline: Represents instagram's timeline. Activity: Represents instagram's user activity. Inbox: Represents instagram's messages. Location: Represents instagram's locations.

See Scheme section in README.md for more information.

We recommend to use Export and Import functions after first Login.

Also you can use SetProxy and UnsetProxy to set and unset proxy. Golang also provides the option to set a proxy using HTTP_PROXY env var.

func Import

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

Import imports instagram configuration

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

func ImportConfig

func ImportConfig(config ConfigFile) (*Instagram, error)

ImportConfig imports instagram configuration from a configuration object.

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

func ImportReader

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

ImportReader imports instagram configuration from io.Reader

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

func New

func New(username, password string) *Instagram

New creates Instagram structure

func (*Instagram) Export

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

Export exports *Instagram object options

func (*Instagram) GetMedia

func (inst *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 (inst *Instagram) Login() error

Login performs instagram login.

Password will be deleted after login

func (*Instagram) Logout

func (inst *Instagram) Logout() error

Logout closes current session

func (*Instagram) NewHashtag

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

NewHashtag returns initialised hashtag structure Name parameter is hashtag name

func (*Instagram) NewUser

func (inst *Instagram) NewUser() *User

NewUser returns prepared user to be used with his functions.

func (*Instagram) Save

func (inst *Instagram) Save() error

Save exports config to ~/.goinsta

func (*Instagram) SetCookieJar

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

SetCookieJar sets the Cookie Jar. This further allows to use a custom implementation of a cookie jar which may be backed by a different data store such as redis.

func (*Instagram) SetDeviceID

func (inst *Instagram) SetDeviceID(id string)

SetDeviceID sets device id

func (*Instagram) SetHTTPClient

func (inst *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 (inst *Instagram) SetHTTPTransport(transport http.RoundTripper)

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

func (*Instagram) SetPhoneID

func (inst *Instagram) SetPhoneID(id string)

SetPhoneID sets phone id

func (*Instagram) SetProxy

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

SetProxy sets proxy for connection.

func (*Instagram) SetUUID

func (inst *Instagram) SetUUID(uuid string)

SetUUID sets uuid

func (*Instagram) UnsetProxy

func (inst *Instagram) UnsetProxy()

UnsetProxy unsets proxy for connection.

func (*Instagram) UploadAlbum

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

UploadAlbum post image from io.Reader to instagram.

func (*Instagram) UploadPhoto

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

UploadPhoto post image from io.Reader to instagram.

type Item

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

	TakenAt          int64   `json:"taken_at"`
	Pk               int64   `json:"pk"`
	ID               string  `json:"id"`
	CommentsDisabled bool    `json:"comments_disabled"`
	DeviceTimestamp  int64   `json:"device_timestamp"`
	MediaType        int     `json:"media_type"`
	Code             string  `json:"code"`
	ClientCacheKey   string  `json:"client_cache_key"`
	FilterType       int     `json:"filter_type"`
	CarouselParentID string  `json:"carousel_parent_id"`
	CarouselMedia    []Item  `json:"carousel_media,omitempty"`
	User             User    `json:"user"`
	CanViewerReshare bool    `json:"can_viewer_reshare"`
	Caption          Caption `json:"caption"`
	CaptionIsEdited  bool    `json:"caption_is_edited"`
	Likes            int     `json:"like_count"`
	HasLiked         bool    `json:"has_liked"`
	// Toplikers can be `string` or `[]string`.
	// Use TopLikers function instead of getting it directly.
	Toplikers                    interface{} `json:"top_likers"`
	Likers                       []User      `json:"likers"`
	CommentLikesEnabled          bool        `json:"comment_likes_enabled"`
	CommentThreadingEnabled      bool        `json:"comment_threading_enabled"`
	HasMoreComments              bool        `json:"has_more_comments"`
	MaxNumVisiblePreviewComments int         `json:"max_num_visible_preview_comments"`
	// Previewcomments can be `string` or `[]string` or `[]Comment`.
	// Use PreviewComments function instead of getting it directly.
	Previewcomments interface{} `json:"preview_comments,omitempty"`
	CommentCount    int         `json:"comment_count"`
	PhotoOfYou      bool        `json:"photo_of_you"`
	// Tags are tagged people in photo
	Tags struct {
		In []Tag `json:"in"`
	} `json:"usertags,omitempty"`
	FbUserTags           Tag    `json:"fb_user_tags"`
	CanViewerSave        bool   `json:"can_viewer_save"`
	OrganicTrackingToken string `json:"organic_tracking_token"`
	// Images contains URL images in different versions.
	// Version = quality.
	Images          Images   `json:"image_versions2,omitempty"`
	OriginalWidth   int      `json:"original_width,omitempty"`
	OriginalHeight  int      `json:"original_height,omitempty"`
	ImportedTakenAt int64    `json:"imported_taken_at,omitempty"`
	Location        Location `json:"location,omitempty"`
	Lat             float64  `json:"lat,omitempty"`
	Lng             float64  `json:"lng,omitempty"`

	// Videos
	Videos            []Video `json:"video_versions,omitempty"`
	HasAudio          bool    `json:"has_audio,omitempty"`
	VideoDuration     float64 `json:"video_duration,omitempty"`
	ViewCount         float64 `json:"view_count,omitempty"`
	IsDashEligible    int     `json:"is_dash_eligible,omitempty"`
	VideoDashManifest string  `json:"video_dash_manifest,omitempty"`
	NumberOfQualities int     `json:"number_of_qualities,omitempty"`

	// Only for stories
	StoryEvents              []interface{}      `json:"story_events"`
	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"`
	ReelMentions             []StoryReelMention `json:"reel_mentions"`
	SupportsReelReactions    bool               `json:"supports_reel_reactions"`
	ShowOneTapFbShareTooltip bool               `json:"show_one_tap_fb_share_tooltip"`
	HasSharedToFb            int64              `json:"has_shared_to_fb"`
	Mentions                 []Mentions
	Audience                 string `json:"audience,omitempty"`
	StoryMusicStickers       []struct {
		X              float64 `json:"x"`
		Y              float64 `json:"y"`
		Z              int     `json:"z"`
		Width          float64 `json:"width"`
		Height         float64 `json:"height"`
		Rotation       float64 `json:"rotation"`
		IsPinned       int     `json:"is_pinned"`
		IsHidden       int     `json:"is_hidden"`
		IsSticker      int     `json:"is_sticker"`
		MusicAssetInfo struct {
			ID                       string `json:"id"`
			Title                    string `json:"title"`
			Subtitle                 string `json:"subtitle"`
			DisplayArtist            string `json:"display_artist"`
			CoverArtworkURI          string `json:"cover_artwork_uri"`
			CoverArtworkThumbnailURI string `json:"cover_artwork_thumbnail_uri"`
			ProgressiveDownloadURL   string `json:"progressive_download_url"`
			HighlightStartTimesInMs  []int  `json:"highlight_start_times_in_ms"`
			IsExplicit               bool   `json:"is_explicit"`
			DashManifest             string `json:"dash_manifest"`
			HasLyrics                bool   `json:"has_lyrics"`
			AudioAssetID             string `json:"audio_asset_id"`
			IgArtist                 struct {
				Pk            int    `json:"pk"`
				Username      string `json:"username"`
				FullName      string `json:"full_name"`
				IsPrivate     bool   `json:"is_private"`
				ProfilePicURL string `json:"profile_pic_url"`
				ProfilePicID  string `json:"profile_pic_id"`
				IsVerified    bool   `json:"is_verified"`
			} `json:"ig_artist"`
			PlaceholderProfilePicURL string `json:"placeholder_profile_pic_url"`
			ShouldMuteAudio          bool   `json:"should_mute_audio"`
			ShouldMuteAudioReason    string `json:"should_mute_audio_reason"`
			OverlapDurationInMs      int    `json:"overlap_duration_in_ms"`
			AudioAssetStartTimeInMs  int    `json:"audio_asset_start_time_in_ms"`
		} `json:"music_asset_info"`
	} `json:"story_music_stickers,omitempty"`
	// contains filtered or unexported fields
}

Item represents media items

All Item has Images or Videos objects which contains the url(s). You can use Download function to get the best quality Image or Video from Item.

func (*Item) Comment

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

Comment pushes a text comment to media item.

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

func (*Item) Delete

func (item *Item) Delete() error

Delete deletes your media item. StoryMedia or FeedMedia

See example: examples/media/mediaDelete.go

func (*Item) Download

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

Download downloads media item (video or image) with the best quality.

Input parameters are folder and filename. If filename is "" will be saved with the default value name.

If file exists it will be saved This function makes folder automatically

This function returns an slice of location of downloaded items The returned values are the output path of images and videos.

This function does not download CarouselMedia.

See example: examples/media/itemDownload.go

func (*Item) Hashtags

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

Hashtags returns caption hashtags.

Item media parent must be FeedMedia.

See example: examples/media/hashtags.go

func (*Item) Like

func (item *Item) Like() error

Like mark media item as liked.

See example: examples/media/like.go

func (*Item) MediaToString

func (item *Item) MediaToString() string

MediaToString returns Item.MediaType as string.

func (*Item) PreviewComments

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

PreviewComments returns string slice or single string (inside Comment slice) Depending on PreviewComments parameter. If PreviewComments are string or []string only the Text field will be filled.

func (*Item) Save

func (item *Item) Save() error

Save saves media item.

You can get saved media using Account.Saved()

func (*Item) StoryIsCloseFriends

func (item *Item) StoryIsCloseFriends() bool

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

func (*Item) SyncLikers

func (item *Item) SyncLikers() error

SyncLikers fetch new likers of a media

This function updates Item.Likers value

func (*Item) TopLikers

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

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

func (*Item) Unlike

func (item *Item) Unlike() error

Unlike mark media item as unliked.

See example: examples/media/unlike.go

type LayoutSection

type LayoutSection struct {
	LayoutType    string `json:"layout_type"`
	LayoutContent struct {
		Medias []struct {
			Media Item `json:"media"`
		} `json:"medias"`
	} `json:"layout_content"`
	FeedType        string `json:"feed_type"`
	ExploreItemInfo struct {
		NumColumns      int  `json:"num_columns"`
		TotalNumColumns int  `json:"total_num_columns"`
		AspectRatio     int  `json:"aspect_ratio"`
		Autoplay        bool `json:"autoplay"`
	} `json:"explore_item_info"`
}

type LiveItems

type LiveItems struct {
	ID                  string      `json:"pk"`
	User                User        `json:"user"`
	Broadcasts          []Broadcast `json:"broadcasts"`
	LastSeenBroadcastTs float64     `json:"last_seen_broadcast_ts"`
	RankedPosition      int64       `json:"ranked_position"`
	SeenRankedPosition  int64       `json:"seen_ranked_position"`
	Muted               bool        `json:"muted"`
	CanReply            bool        `json:"can_reply"`
	CanReshare          bool        `json:"can_reshare"`
}

LiveItems are Live media items

type Location

type Location struct {
	Pk               int64   `json:"pk"`
	Name             string  `json:"name"`
	Address          string  `json:"address"`
	City             string  `json:"city"`
	ShortName        string  `json:"short_name"`
	Lng              float64 `json:"lng"`
	Lat              float64 `json:"lat"`
	ExternalSource   string  `json:"external_source"`
	FacebookPlacesID int64   `json:"facebook_places_id"`
}

Location stores media location information.

type LocationInstance

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

func (*LocationInstance) Feeds

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

type Media

type Media interface {
	// Next allows pagination
	Next(...interface{}) bool
	// Error returns error (in case it have been occurred)
	Error() error
	// ID returns media id
	ID() string
	// Delete removes media
	Delete() error
	// contains filtered or unexported methods
}

Media interface defines methods for both StoryMedia and FeedMedia.

type 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 MineActivity

type MineActivity struct {

	// Ad is every column of Activity section
	Ad struct {
		Items []struct {
			//User            User          `json:"user"`
			Algorithm       string        `json:"algorithm"`
			SocialContext   string        `json:"social_context"`
			Icon            string        `json:"icon"`
			Caption         string        `json:"caption"`
			MediaIds        []interface{} `json:"media_ids"`
			ThumbnailUrls   []interface{} `json:"thumbnail_urls"`
			LargeUrls       []interface{} `json:"large_urls"`
			MediaInfos      []interface{} `json:"media_infos"`
			Value           float64       `json:"value"`
			IsNewSuggestion bool          `json:"is_new_suggestion"`
		} `json:"items"`
		MoreAvailable bool `json:"more_available"`
	} `json:"aymf"`
	Counts struct {
		PhotosOfYou int `json:"photos_of_you"`
		Requests    int `json:"requests"`
	} `json:"counts"`
	FriendRequestStories []interface{} `json:"friend_request_stories"`
	Stories              []struct {
		Type      int `json:"type"`
		StoryType int `json:"story_type"`
		Args      struct {
			Text  string `json:"text"`
			Links []struct {
				Start int    `json:"start"`
				End   int    `json:"end"`
				Type  string `json:"type"`
				ID    string `json:"id"`
			} `json:"links"`
			InlineFollow struct {
				UserInfo        User `json:"user_info"`
				Following       bool `json:"following"`
				OutgoingRequest bool `json:"outgoing_request"`
			} `json:"inline_follow"`
			Actions         []string `json:"actions"`
			ProfileID       int64    `json:"profile_id"`
			ProfileImage    string   `json:"profile_image"`
			Timestamp       float64  `json:"timestamp"`
			Tuuid           string   `json:"tuuid"`
			Clicked         bool     `json:"clicked"`
			ProfileName     string   `json:"profile_name"`
			LatestReelMedia int64    `json:"latest_reel_media"`
		} `json:"args"`
		Counts struct {
		} `json:"counts"`
		Pk string `json:"pk"`
	} `json:"old_stories"`
	ContinuationToken int64       `json:"continuation_token"`
	Subscription      interface{} `json:"subscription"`
	NextID            int64       `json:"next_max_id"`
	Status            string      `json:"status"`
	// contains filtered or unexported fields
}

MineActivity is the recent activity menu.

See example: examples/activity/recent.go

func (*MineActivity) Error

func (act *MineActivity) Error() error

func (*MineActivity) Next

func (act *MineActivity) Next() bool

Next function allows pagination over notifications.

See example: examples/activity/recent.go

type Nametag

type Nametag struct {
	Mode          int64       `json:"mode"`
	Gradient      json.Number `json:"gradient,Number"`
	Emoji         string      `json:"emoji"`
	SelfieSticker json.Number `json:"selfie_sticker,Number"`
}

Nametag is part of the account information.

type PicURLInfo

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

PicURLInfo repre

type Profiles

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

Profiles allows user function interactions

func (*Profiles) Blocked

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

Blocked returns a list of blocked profiles.

func (*Profiles) ByID

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

ByID returns a *User structure parsed by user id

func (*Profiles) ByName

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

ByName return a *User structure parsed by username

type SavedMedia

type SavedMedia struct {
	Items []struct {
		Media Item `json:"media"`
	} `json:"items"`
	NumResults          int    `json:"num_results"`
	MoreAvailable       bool   `json:"more_available"`
	AutoLoadMoreEnabled bool   `json:"auto_load_more_enabled"`
	Status              string `json:"status"`
}

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

type School

type School struct {
}

School is void structure (yet).

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

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

func (*Search) Facebook

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

Facebook search by facebook user.

func (*Search) Location

func (search *Search) Location(lat, lng, location string) (*SearchResult, error)

Location search by location. DEPRECATED - Instagram does not allow Location search method. Lat and Lng (Latitude & Longitude) cannot be ""

func (*Search) Tags

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

Tags search by tag

func (*Search) User

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

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

type SearchResult

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

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

	// Tag search results
	Tags []struct {
		ID               int64       `json:"id"`
		Name             string      `json:"name"`
		MediaCount       int         `json:"media_count"`
		FollowStatus     interface{} `json:"follow_status"`
		Following        interface{} `json:"following"`
		AllowFollowing   interface{} `json:"allow_following"`
		AllowMutingStory interface{} `json:"allow_muting_story"`
		ProfilePicURL    interface{} `json:"profile_pic_url"`
		NonViolating     interface{} `json:"non_violating"`
		RelatedTags      interface{} `json:"related_tags"`
		DebugInfo        interface{} `json:"debug_info"`
	} `json:"results"`

	// Location search result
	RequestID string `json:"request_id"`
	Venues    []struct {
		ExternalIDSource string  `json:"external_id_source"`
		ExternalID       string  `json:"external_id"`
		Lat              float64 `json:"lat"`
		Lng              float64 `json:"lng"`
		Address          string  `json:"address"`
		Name             string  `json:"name"`
	} `json:"venues"`

	// Facebook
	// Facebook also uses `Users`
	Places   []interface{} `json:"places"`
	Hashtags []struct {
		Position int `json:"position"`
		Hashtag  struct {
			Name       string `json:"name"`
			ID         int64  `json:"id"`
			MediaCount int    `json:"media_count"`
		} `json:"hashtag"`
	} `json:"hashtags"`
	ClearClientCache bool `json:"clear_client_cache"`
}

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

type Section

type Section struct {
	Sections      []LayoutSection `json:"sections"`
	MoreAvailable bool            `json:"more_available"`
	NextPage      int             `json:"next_page"`
	NextMediaIds  []int64         `json:"next_media_ids"`
	NextMaxID     string          `json:"next_max_id"`
	Status        string          `json:"status"`
}

type StoryCTA

type StoryCTA struct {
	Links []struct {
		LinkType                                int         `json:"linkType"`
		WebURI                                  string      `json:"webUri"`
		AndroidClass                            string      `json:"androidClass"`
		Package                                 string      `json:"package"`
		DeeplinkURI                             string      `json:"deeplinkUri"`
		CallToActionTitle                       string      `json:"callToActionTitle"`
		RedirectURI                             interface{} `json:"redirectUri"`
		LeadGenFormID                           string      `json:"leadGenFormId"`
		IgUserID                                string      `json:"igUserId"`
		AppInstallObjectiveInvalidationBehavior interface{} `json:"appInstallObjectiveInvalidationBehavior"`
	} `json:"links"`
}

StoryCTA represent story cta

type StoryMedia

type StoryMedia struct {
	Pk              interface{} `json:"id"`
	LatestReelMedia int64       `json:"latest_reel_media"`
	ExpiringAt      float64     `json:"expiring_at"`
	HaveBeenSeen    float64     `json:"seen"`
	CanReply        bool        `json:"can_reply"`
	Title           string      `json:"title"`
	CanReshare      bool        `json:"can_reshare"`
	ReelType        string      `json:"reel_type"`
	User            User        `json:"user"`
	Items           []Item      `json:"items"`
	ReelMentions    []string    `json:"reel_mentions"`
	PrefetchCount   int         `json:"prefetch_count"`
	// this field can be int or bool
	HasBestiesMedia      interface{} `json:"has_besties_media"`
	StoryRankingToken    string      `json:"story_ranking_token"`
	Broadcasts           []Broadcast `json:"broadcasts"`
	FaceFilterNuxVersion int         `json:"face_filter_nux_version"`
	HasNewNuxStory       bool        `json:"has_new_nux_story"`
	Status               string      `json:"status"`
	// contains filtered or unexported fields
}

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

func (*StoryMedia) Delete

func (media *StoryMedia) Delete() error

Delete removes instragram story.

See example: examples/media/deleteStories.go

func (StoryMedia) Error

func (media StoryMedia) Error() error

Error returns error happened any error

func (*StoryMedia) ID

func (media *StoryMedia) ID() string

ID returns Story id

func (*StoryMedia) Next

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

Next allows pagination after calling: User.Stories

returns false when list reach the end if StoryMedia.Error() is ErrNoMore no problem have been occurred.

func (*StoryMedia) Sync

func (media *StoryMedia) Sync() error

Sync function is used when Highlight must be sync. Highlight must be sync when User.Highlights does not return any object inside StoryMedia slice.

This function does NOT update Stories items.

This function updates StoryMedia.Items

type StoryReelMention

type StoryReelMention struct {
	X        float64 `json:"x"`
	Y        float64 `json:"y"`
	Z        int     `json:"z"`
	Width    float64 `json:"width"`
	Height   float64 `json:"height"`
	Rotation float64 `json:"rotation"`
	IsPinned int     `json:"is_pinned"`
	IsHidden int     `json:"is_hidden"`
	User     User
}

StoryReelMention represent story reel mention

type SuggestedUsers

type SuggestedUsers struct {
	Type        int `json:"type"`
	Suggestions []struct {
		User            User          `json:"user"`
		Algorithm       string        `json:"algorithm"`
		SocialContext   string        `json:"social_context"`
		Icon            string        `json:"icon"`
		Caption         string        `json:"caption"`
		MediaIds        []interface{} `json:"media_ids"`
		ThumbnailUrls   []interface{} `json:"thumbnail_urls"`
		LargeUrls       []interface{} `json:"large_urls"`
		MediaInfos      []interface{} `json:"media_infos"`
		Value           float64       `json:"value"`
		IsNewSuggestion bool          `json:"is_new_suggestion"`
	} `json:"suggestions"`
	LandingSiteType  string `json:"landing_site_type"`
	Title            string `json:"title"`
	ViewAllText      string `json:"view_all_text"`
	LandingSiteTitle string `json:"landing_site_title"`
	NetegoType       string `json:"netego_type"`
	UpsellFbPos      string `json:"upsell_fb_pos"`
	AutoDvance       string `json:"auto_dvance"`
	ID               string `json:"id"`
	TrackingToken    string `json:"tracking_token"`
}

SuggestedUsers stores the information about user suggestions.

type SyncAnswer

type SyncAnswer struct {
	Users []struct {
		Pk                         int64  `json:"pk"`
		Username                   string `json:"username"`
		FullName                   string `json:"full_name"`
		IsPrivate                  bool   `json:"is_private"`
		ProfilePicURL              string `json:"profile_pic_url"`
		ProfilePicID               string `json:"profile_pic_id"`
		IsVerified                 bool   `json:"is_verified"`
		HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
		ReelAutoArchive            string `json:"reel_auto_archive"`
		AddressbookName            string `json:"addressbook_name"`
	} `json:"users"`
	Warning string `json:"warning"`
	Status  string `json:"status"`
}

type Tag

type Tag struct {
	In []struct {
		User                  User        `json:"user"`
		Position              []float64   `json:"position"`
		StartTimeInVideoInSec interface{} `json:"start_time_in_video_in_sec"`
		DurationInVideoInSec  interface{} `json:"duration_in_video_in_sec"`
	} `json:"in"`
}

Tag is the information of an user being tagged on any media.

type Timeline

type Timeline struct {
	// 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) Get

func (time *Timeline) Get() *FeedMedia

Get returns latest media from timeline.

For pagination use FeedMedia.Next()

func (*Timeline) Stories

func (time *Timeline) Stories() (*Tray, error)

Stories returns slice of StoryMedia

type Tray

type Tray struct {
	Stories []StoryMedia `json:"tray"`
	Lives   struct {
		LiveItems []LiveItems `json:"post_live_items"`
	} `json:"post_live"`
	StoryRankingToken    string      `json:"story_ranking_token"`
	Broadcasts           []Broadcast `json:"broadcasts"`
	FaceFilterNuxVersion int         `json:"face_filter_nux_version"`
	HasNewNuxStory       bool        `json:"has_new_nux_story"`
	Status               string      `json:"status"`
}

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

type User

type User struct {
	ID                         int64   `json:"pk"`
	Username                   string  `json:"username"`
	FullName                   string  `json:"full_name"`
	Biography                  string  `json:"biography"`
	ProfilePicURL              string  `json:"profile_pic_url"`
	Email                      string  `json:"email"`
	PhoneNumber                string  `json:"phone_number"`
	IsBusiness                 bool    `json:"is_business"`
	Gender                     int     `json:"gender"`
	ProfilePicID               string  `json:"profile_pic_id"`
	HasAnonymousProfilePicture bool    `json:"has_anonymous_profile_picture"`
	IsPrivate                  bool    `json:"is_private"`
	IsUnpublished              bool    `json:"is_unpublished"`
	AllowedCommenterType       string  `json:"allowed_commenter_type"`
	IsVerified                 bool    `json:"is_verified"`
	MediaCount                 int     `json:"media_count"`
	FollowerCount              int     `json:"follower_count"`
	FollowingCount             int     `json:"following_count"`
	FollowingTagCount          int     `json:"following_tag_count"`
	MutualFollowersID          []int64 `json:"profile_context_mutual_follow_ids"`
	ProfileContext             string  `json:"profile_context"`
	GeoMediaCount              int     `json:"geo_media_count"`
	ExternalURL                string  `json:"external_url"`
	HasBiographyTranslation    bool    `json:"has_biography_translation"`
	ExternalLynxURL            string  `json:"external_lynx_url"`
	BiographyWithEntities      struct {
		RawText  string        `json:"raw_text"`
		Entities []interface{} `json:"entities"`
	} `json:"biography_with_entities"`
	UsertagsCount                int          `json:"usertags_count"`
	HasChaining                  bool         `json:"has_chaining"`
	IsFavorite                   bool         `json:"is_favorite"`
	IsFavoriteForStories         bool         `json:"is_favorite_for_stories"`
	IsFavoriteForHighlights      bool         `json:"is_favorite_for_highlights"`
	CanBeReportedAsFraud         bool         `json:"can_be_reported_as_fraud"`
	ShowShoppableFeed            bool         `json:"show_shoppable_feed"`
	ShoppablePostsCount          int          `json:"shoppable_posts_count"`
	ReelAutoArchive              string       `json:"reel_auto_archive"`
	HasHighlightReels            bool         `json:"has_highlight_reels"`
	PublicEmail                  string       `json:"public_email"`
	PublicPhoneNumber            string       `json:"public_phone_number"`
	PublicPhoneCountryCode       string       `json:"public_phone_country_code"`
	ContactPhoneNumber           string       `json:"contact_phone_number"`
	CityID                       int64        `json:"city_id"`
	CityName                     string       `json:"city_name"`
	AddressStreet                string       `json:"address_street"`
	DirectMessaging              string       `json:"direct_messaging"`
	Latitude                     float64      `json:"latitude"`
	Longitude                    float64      `json:"longitude"`
	Category                     string       `json:"category"`
	BusinessContactMethod        string       `json:"business_contact_method"`
	IncludeDirectBlacklistStatus bool         `json:"include_direct_blacklist_status"`
	HdProfilePicURLInfo          PicURLInfo   `json:"hd_profile_pic_url_info"`
	HdProfilePicVersions         []PicURLInfo `json:"hd_profile_pic_versions"`
	School                       School       `json:"school"`
	Byline                       string       `json:"byline"`
	SocialContext                string       `json:"social_context,omitempty"`
	SearchSocialContext          string       `json:"search_social_context,omitempty"`
	MutualFollowersCount         float64      `json:"mutual_followers_count"`
	LatestReelMedia              int64        `json:"latest_reel_media,omitempty"`
	IsCallToActionEnabled        bool         `json:"is_call_to_action_enabled"`
	FbPageCallToActionID         string       `json:"fb_page_call_to_action_id"`
	Zip                          string       `json:"zip"`
	Friendship                   Friendship   `json:"friendship_status"`
	// contains filtered or unexported fields
}

User is the representation of instagram's user profile

func (*User) Block

func (user *User) Block() error

Block blocks user

This function updates current User.Friendship structure.

See example: examples/user/block.go

func (*User) Feed

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

Feed returns user feeds (media)

params can be:
	string: timestamp of the minimum media timestamp.

For pagination use FeedMedia.Next()

See example: examples/user/feed.go

func (*User) Follow

func (user *User) Follow() error

Follow started following some user

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

If the account is public User.Friendship will be updated

See example: examples/user/follow.go

func (*User) Followers

func (user *User) Followers() *Users

Followers returns a list of user followers.

Users.Next can be used to paginate

See example: examples/user/followers.go

func (*User) Following

func (user *User) Following() *Users

Following returns a list of user following.

Users.Next can be used to paginate

See example: examples/user/following.go

func (*User) FriendShip

func (user *User) FriendShip() error

FriendShip allows user to get friend relationship.

The result is stored in user.Friendship

func (*User) Highlights

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

Highlights represents saved stories.

See example: examples/user/highlights.go

func (*User) Mute

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

Mute mutes user from appearing in the feed or story reel

Use one of the pre-defined constants to choose what exactly to mute: goinsta.MuteAll, goinsta.MuteStory, goinsta.MuteFeed This function updates current User.Friendship structure.

func (*User) SetInstagram

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

SetInstagram will update instagram instance for selected User.

func (*User) Stories

func (user *User) Stories() *StoryMedia

Stories returns user stories

Use StoryMedia.Next for pagination.

See example: examples/user/stories.go

func (*User) Sync

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

Sync updates user info

params can be:
	bool: must be true if you want to include FriendShip call. See goinsta.FriendShip

See example: examples/user/friendship.go

func (*User) Tags

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

Tags returns media where user is tagged in

For pagination use FeedMedia.Next()

See example: examples/user/tags.go

func (*User) Unblock

func (user *User) Unblock() error

Unblock unblocks user

This function updates current User.Friendship structure.

See example: examples/user/unblock.go

func (*User) Unfollow

func (user *User) Unfollow() error

Unfollow unfollows user

User.Friendship will be updated

See example: examples/user/unfollow.go

func (*User) Unmute

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

Unmute unmutes user so it appears in the feed or story reel again

Use one of the pre-defined constants to choose what exactly to unmute: goinsta.MuteAll, goinsta.MuteStory, goinsta.MuteFeed This function updates current User.Friendship structure.

type Users

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

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

func (*Users) Error

func (users *Users) Error() error

Error returns users error

func (*Users) Next

func (users *Users) Next() bool

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

New user list is stored inside Users

returns false when list reach the end.

func (*Users) SetInstagram

func (users *Users) SetInstagram(inst *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

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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