instagram

package module
v0.0.0-...-7c6db04 Latest Latest
Warning

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

Go to latest
Published: May 16, 2016 License: MIT Imports: 16 Imported by: 1

README

Instagram private API for Go language


Go Report Card

Install:

go get -u github.com/gkiryaziev/go-instagram

Functions and description:

NewInstagram(userName, password string) (*instagram, error) Create a new object of Instagram. Constructor takes a user name and password as arguments and call Login() method after a successful initialization.

Login() error Login to Instagram server.

GetMediaLikers(mediaId string) (*MediaLikers, error) Getting information about likers. Method takes the id of media as argument.

GetMedia(mediaId string) (*Media, error) Getting information about media and comments. Method takes the id of media as argument.

GetRecentActivity() (*RecentActivity, error) Getting recent activity.

SearchUsers(query string) (*SearchUsers, error) Search user. Method takes query string as argument.

GetUserNameInfo(userNameId int64) (*UserNameInfo, error) Getting information about user. Method takes the id of user as argument.

GetUserTags(userNameId int64) (*UserTags, error) Getting user tags. Method takes the id of user as argument.

SearchTags(query string) (*SearchTags, error) Search tag. Method takes query string as argument.

TagFeed(tag, maxId string) (*TagFeed, error) Getting media with tag. Method takes the tag and id of the next page.

Documentation

Index

Constants

View Source
const (
	// APIURL api url
	APIURL = "https://i.instagram.com/api/v1"
	// USERAGENT user agent
	USERAGENT = "Instagram 7.13.1 Android (23/6.0.1; 515dpi; 1440x2416; huawei/google; Nexus 6P; angler; angler; en_US)"
	// IGSIGKEY ig sig key
	IGSIGKEY = "8b46309eb680f272cc770d214b7dbe5f0c5d26b6cb82b0b740257360b43618f0"
	// SIGKEYVERSION sig key version
	SIGKEYVERSION = "4"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Instagram

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

Instagram struct

func NewInstagram

func NewInstagram(userName, password string) (*Instagram, error)

NewInstagram api

func (*Instagram) GetMedia

func (i *Instagram) GetMedia(mediaID string) (*Media, error)

GetMedia return media comments.

func (*Instagram) GetMediaLikers

func (i *Instagram) GetMediaLikers(mediaID string) (*MediaLikers, error)

GetMediaLikers return media likers.

func (*Instagram) GetRecentActivity

func (i *Instagram) GetRecentActivity() (*RecentActivity, error)

GetRecentActivity return recent activity.

func (*Instagram) GetUserNameInfo

func (i *Instagram) GetUserNameInfo(userNameID int64) (*UserNameInfo, error)

GetUserNameInfo return username info.

func (*Instagram) GetUserTags

func (i *Instagram) GetUserTags(userNameID int64) (*UserTags, error)

GetUserTags return user tags.

func (*Instagram) Login

func (i *Instagram) Login() error

Login to instagram.

func (*Instagram) SearchTags

func (i *Instagram) SearchTags(query string) (*SearchTags, error)

SearchTags return tags.

func (*Instagram) SearchUsers

func (i *Instagram) SearchUsers(query string) (*SearchUsers, error)

SearchUsers return users.

func (*Instagram) TagFeed

func (i *Instagram) TagFeed(tag, maxID string) (*TagFeed, error)

TagFeed return tagged media.

type Login

type Login struct {
	DeviceID          string `json:"device_id"`
	GUID              string `json:"guid"`
	UserName          string `json:"username"`
	Password          string `json:"password"`
	Csrftoken         string `json:"csrftoken"`
	LoginAttemptCount string `json:"login_attempt_count"`
}

Login struct

type LoginResponse

type LoginResponse struct {
	LoggedInUser struct {
		Username                   string `json:"username"`
		HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
		ProfilePicURL              string `json:"profile_pic_url"`
		FullName                   string `json:"full_name"`
		Pk                         int64  `json:"pk"`
		IsPrivate                  bool   `json:"is_private"`
	} `json:"logged_in_user"`
	Status  string `json:"status"`
	Message string `json:"message"` // from Error
}

LoginResponse struct

type Media

type Media struct {
	Status          string `json:"status"`
	CaptionIsEdited bool   `json:"caption_is_edited"`
	HasMoreComments bool   `json:"has_more_comments"`
	Comments        []struct {
		Status    string  `json:"status"`
		MediaID   int64   `json:"media_id"`
		Text      string  `json:"text"`
		CreatedAt float64 `json:"created_at"`
		User      struct {
			Username                   string `json:"username"`
			HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
			ProfilePicURL              string `json:"profile_pic_url"`
			FullName                   string `json:"full_name"`
			Pk                         int64  `json:"pk"`
			IsPrivate                  bool   `json:"is_private"`
		} `json:"user"`
		ContentType  string `json:"content_type"`
		CreatedAtUtc int    `json:"created_at_utc"`
		Pk           int64  `json:"pk"`
		Type         int    `json:"type"`
	} `json:"comments"`
	Caption struct {
		Status       string `json:"status"`
		UserID       int64  `json:"user_id"`
		CreatedAtUtc int    `json:"created_at_utc"`
		CreatedAt    int    `json:"created_at"`
		BitFlags     int    `json:"bit_flags"`
		User         struct {
			Username      string `json:"username"`
			Pk            int64  `json:"pk"`
			ProfilePicURL string `json:"profile_pic_url"`
			IsPrivate     bool   `json:"is_private"`
			FullName      string `json:"full_name"`
		} `json:"user"`
		ContentType string `json:"content_type"`
		Text        string `json:"text"`
		Pk          int64  `json:"pk"`
		Type        int    `json:"type"`
	} `json:"caption"`
	CommentCount int    `json:"comment_count"`
	Message      string `json:"message"` // from Error
}

Media struct

type MediaLikers

type MediaLikers struct {
	Status    string `json:"status"`
	UserCount int    `json:"user_count"`
	Users     []struct {
		Username      string `json:"username"`
		Pk            int64  `json:"pk"`
		ProfilePicURL string `json:"profile_pic_url"`
		IsPrivate     bool   `json:"is_private"`
		FullName      string `json:"full_name"`
	} `json:"users"`
	Message string `json:"message"` // from Error
}

MediaLikers struct

type Message

type Message struct {
	Status  string `json:"status"`
	Message string `json:"message"` // from Error
}

Message struct

type RecentActivity

type RecentActivity struct {
	Status               string                  `json:"status"`
	NewStories           []RecentActivityStories `json:"new_stories"`
	OldStories           []RecentActivityStories `json:"old_stories"`
	ContinuationToken    int                     `json:"continuation_token"`
	FriendRequestStories []struct{}              `json:"friend_request_stories"`
	Counts               struct {
		Relationships int `json:"relationships"`
		PhotosOfYou   int `json:"photos_of_you"`
		Usertags      int `json:"usertags"`
		Comments      int `json:"comments"`
		Likes         int `json:"likes"`
		Requests      int `json:"requests"`
	} `json:"counts"`
	Subscription interface{} `json:"subscription"`
	Message      string      `json:"message"` // from Error
}

RecentActivity struct

type RecentActivityStories

type RecentActivityStories struct {
	Pk     string `json:"pk"`
	Counts struct {
		Relationships int `json:"relationships"`
		Usertags      int `json:"usertags"`
		Likes         int `json:"likes"`
		Comments      int `json:"comments"`
	} `json:"counts"`
	Args struct {
		Media []struct {
			Image string `json:"image"`
			ID    string `json:"id"`
		} `json:"media"`
		Links []struct {
			Start int    `json:"start"`
			End   int    `json:"end"`
			ID    string `json:"id"`
			Type  string `json:"type"`
		} `json:"links"`
		Text         string  `json:"text"`
		ProfileID    int64   `json:"profile_id"`
		ProfileImage string  `json:"profile_image"`
		Timestamp    float64 `json:"timestamp"`
		InlineFollow struct {
			Following bool `json:"following"`
			UserInfo  struct {
				Username      string `json:"username"`
				ProfilePicURL string `json:"profile_pic_url"`
				ID            int64  `json:"id"`
				IsPrivate     bool   `json:"is_private"`
			} `json:"user_info"`
			OutgoingRequest bool `json:"outgoing_request"`
		} `json:"inline_follow"`
	} `json:"args"`
	Type int `json:"type"`
}

RecentActivityStories struct

type SearchTags

type SearchTags struct {
	HasMore interface{} `json:"has_more"`
	Status  string      `json:"status"`
	Results []struct {
		MediaCount float64 `json:"media_count"`
		Name       string  `json:"name"`
		ID         int64   `json:"id"`
	} `json:"results"`
	Message string `json:"message"` // from Error
}

SearchTags struct

type SearchUsers

type SearchUsers struct {
	HasMore    bool   `json:"has_more"`
	Status     string `json:"status"`
	NumResults int    `json:"num_results"`
	Users      []struct {
		Username                   string `json:"username"`
		HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
		Byline                     string `json:"byline"`
		FriendshipStatus           struct {
			Following       bool `json:"following"`
			IncomingRequest bool `json:"incoming_request"`
			OutgoingRequest bool `json:"outgoing_request"`
			IsPrivate       bool `json:"is_private"`
		} `json:"friendship_status"`
		MutualFollowersCount float64 `json:"mutual_followers_count"`
		ProfilePicURL        string  `json:"profile_pic_url"`
		FullName             string  `json:"full_name"`
		FollowerCount        int     `json:"follower_count"`
		Pk                   int64   `json:"pk"`
		IsVerified           bool    `json:"is_verified"`
		IsPrivate            bool    `json:"is_private"`
	} `json:"users"`
	Message string `json:"message"` // from Error
}

SearchUsers struct

type TagFeed

type TagFeed struct {
	RankedItems []struct {
		Code     string `json:"code"`
		Usertags struct {
			In []struct {
				Position []float64    `json:"position"`
				User     TagFeedUser2 `json:"user"`
			} `json:"in"`
		} `json:"usertags,omitempty"`
		MaxNumVisiblePreviewComments int                   `json:"max_num_visible_preview_comments"`
		LikeCount                    int                   `json:"like_count"`
		ImageVersions2               TagFeedImageVersions2 `json:"image_versions2"`
		ID                           string                `json:"id"`
		ClientCacheKey               string                `json:"client_cache_key"`
		Comments                     []TagFeedComments     `json:"comments"`
		DeviceTimestamp              float64               `json:"device_timestamp"`
		CommentCount                 int                   `json:"comment_count"`
		MediaType                    int                   `json:"media_type"`
		OrganicTrackingToken         string                `json:"organic_tracking_token"`
		CaptionIsEdited              bool                  `json:"caption_is_edited"`
		OriginalHeight               int                   `json:"original_height"`
		FilterType                   int                   `json:"filter_type"`
		User                         TagFeedUser           `json:"user"`
		Pk                           int64                 `json:"pk"`
		HasLiked                     bool                  `json:"has_liked"`
		HasMoreComments              bool                  `json:"has_more_comments"`
		PhotoOfYou                   bool                  `json:"photo_of_you"`
		Caption                      TagFeedCaption        `json:"caption"`
		TakenAt                      float64               `json:"taken_at"`
		OriginalWidth                int                   `json:"original_width"`
		Lng                          float64               `json:"lng,omitempty"`
		Location                     TagFeedLocation       `json:"location,omitempty"`
		Lat                          float64               `json:"lat,omitempty"`
	} `json:"ranked_items"`
	Status              string `json:"status"`
	NumResults          int    `json:"num_results"`
	AutoLoadMoreEnabled bool   `json:"auto_load_more_enabled"`
	Items               []struct {
		Code                         string                `json:"code"`
		MaxNumVisiblePreviewComments int                   `json:"max_num_visible_preview_comments"`
		LikeCount                    int                   `json:"like_count"`
		ImageVersions2               TagFeedImageVersions2 `json:"image_versions2"`
		Lng                          float64               `json:"lng,omitempty"`
		ID                           string                `json:"id"`
		ClientCacheKey               string                `json:"client_cache_key"`
		Comments                     []TagFeedComments     `json:"comments"`
		DeviceTimestamp              float64               `json:"device_timestamp"`
		CommentCount                 int                   `json:"comment_count"`
		Location                     TagFeedLocation       `json:"location,omitempty"`
		MediaType                    int                   `json:"media_type"`
		OrganicTrackingToken         string                `json:"organic_tracking_token"`
		CaptionIsEdited              bool                  `json:"caption_is_edited"`
		OriginalHeight               int                   `json:"original_height"`
		FilterType                   int                   `json:"filter_type"`
		User                         TagFeedUser           `json:"user"`
		Pk                           int64                 `json:"pk"`
		Lat                          float64               `json:"lat,omitempty"`
		HasLiked                     bool                  `json:"has_liked"`
		HasMoreComments              bool                  `json:"has_more_comments"`
		PhotoOfYou                   bool                  `json:"photo_of_you"`
		Caption                      TagFeedCaption        `json:"caption"`
		TakenAt                      float64               `json:"taken_at"`
		OriginalWidth                int                   `json:"original_width"`
	} `json:"items"`
	MoreAvailable bool   `json:"more_available"`
	NextMaxID     string `json:"next_max_id"`
	Message       string `json:"message"` // from Error
}

TagFeed struct

type TagFeedCaption

type TagFeedCaption struct {
	Status       string       `json:"status"`
	UserID       int          `json:"user_id"`
	CreatedAtUtc int          `json:"created_at_utc"`
	CreatedAt    int          `json:"created_at"`
	BitFlags     int          `json:"bit_flags"`
	User         TagFeedUser2 `json:"user"`
	ContentType  string       `json:"content_type"`
	Text         string       `json:"text"`
	MediaID      int64        `json:"media_id"`
	Pk           int64        `json:"pk"`
	Type         int          `json:"type"`
}

TagFeedCaption struct

type TagFeedComments

type TagFeedComments struct {
	Status       string       `json:"status"`
	UserID       int          `json:"user_id"`
	CreatedAtUtc int          `json:"created_at_utc"`
	CreatedAt    int          `json:"created_at"`
	BitFlags     int          `json:"bit_flags"`
	User         TagFeedUser2 `json:"user"`
	ContentType  string       `json:"content_type"`
	Text         string       `json:"text"`
	MediaID      int64        `json:"media_id"`
	Pk           int64        `json:"pk"`
	Type         int          `json:"type"`
}

TagFeedComments struct

type TagFeedImageVersions2

type TagFeedImageVersions2 struct {
	Candidates []struct {
		URL    string `json:"url"`
		Width  int    `json:"width"`
		Height int    `json:"height"`
	} `json:"candidates"`
}

TagFeedImageVersions2 struct

type TagFeedLocation

type TagFeedLocation struct {
	ExternalSource   string      `json:"external_source"`
	City             string      `json:"city"`
	Name             string      `json:"name"`
	FacebookPlacesID int64       `json:"facebook_places_id"`
	ExternalID       interface{} `json:"external_id"`
	State            string      `json:"state"`
	Address          string      `json:"address"`
	Lat              float64     `json:"lat"`
	Pk               int         `json:"pk"`
	Lng              float64     `json:"lng"`
	FoursquareV2ID   interface{} `json:"foursquare_v2_id"`
}

TagFeedLocation struct

type TagFeedUser

type TagFeedUser struct {
	Username                   string `json:"username"`
	HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
	IsUnpublished              bool   `json:"is_unpublished"`
	FriendshipStatus           struct {
		Following       bool `json:"following"`
		OutgoingRequest bool `json:"outgoing_request"`
	} `json:"friendship_status"`
	ProfilePicURL string `json:"profile_pic_url"`
	IsFavorite    bool   `json:"is_favorite"`
	FullName      string `json:"full_name"`
	Pk            int    `json:"pk"`
	IsPrivate     bool   `json:"is_private"`
}

TagFeedUser struct

type TagFeedUser2

type TagFeedUser2 struct {
	Username      string `json:"username"`
	Pk            int    `json:"pk"`
	ProfilePicURL string `json:"profile_pic_url"`
	IsPrivate     bool   `json:"is_private"`
	FullName      string `json:"full_name"`
}

TagFeedUser2 struct

type UserNameInfo

type UserNameInfo struct {
	Status string `json:"status"`
	User   struct {
		Username                     string `json:"username"`
		IsProfileActionNeeded        bool   `json:"is_profile_action_needed"`
		HasAnonymousProfilePicture   bool   `json:"has_anonymous_profile_picture"`
		MediaCount                   int    `json:"media_count"`
		FollowingCount               int    `json:"following_count"`
		IsNeedy                      bool   `json:"is_needy"`
		AutoExpandChaining           bool   `json:"auto_expand_chaining"`
		HasChaining                  bool   `json:"has_chaining"`
		UsertagReviewEnabled         bool   `json:"usertag_review_enabled"`
		GeoMediaCount                int    `json:"geo_media_count"`
		IncludeDirectBlacklistStatus bool   `json:"include_direct_blacklist_status"`
		ProfilePicURL                string `json:"profile_pic_url"`
		UsertagsCount                int    `json:"usertags_count"`
		Biography                    string `json:"biography"`
		FullName                     string `json:"full_name"`
		FollowerCount                int    `json:"follower_count"`
		Pk                           int64  `json:"pk"`
		IsVerified                   bool   `json:"is_verified"`
		IsPrivate                    bool   `json:"is_private"`
		ExternalURL                  string `json:"external_url"`
	} `json:"user"`
	Message string `json:"message"` // from Error
}

UserNameInfo struct

type UserTags

type UserTags struct {
	Status              string `json:"status"`
	NumResults          int    `json:"num_results"`
	AutoLoadMoreEnabled bool   `json:"auto_load_more_enabled"`
	Items               []struct {
		Code     string `json:"code"`
		Usertags struct {
			In []struct {
				Position []float64 `json:"position"`
				User     struct {
					Username      string `json:"username"`
					Pk            int    `json:"pk"`
					ProfilePicURL string `json:"profile_pic_url"`
					IsPrivate     bool   `json:"is_private"`
					FullName      string `json:"full_name"`
				} `json:"user"`
			} `json:"in"`
		} `json:"usertags"`
		MaxNumVisiblePreviewComments int `json:"max_num_visible_preview_comments"`
		LikeCount                    int `json:"like_count"`
		ImageVersions2               struct {
			Candidates []struct {
				URL    string `json:"url"`
				Width  int    `json:"width"`
				Height int    `json:"height"`
			} `json:"candidates"`
		} `json:"image_versions2"`
		ID             string `json:"id"`
		ClientCacheKey string `json:"client_cache_key"`
		Comments       []struct {
			Status       string `json:"status"`
			UserID       int    `json:"user_id"`
			CreatedAtUtc int    `json:"created_at_utc"`
			CreatedAt    int    `json:"created_at"`
			BitFlags     int    `json:"bit_flags"`
			User         struct {
				Username      string `json:"username"`
				Pk            int    `json:"pk"`
				ProfilePicURL string `json:"profile_pic_url"`
				IsPrivate     bool   `json:"is_private"`
				FullName      string `json:"full_name"`
			} `json:"user"`
			ContentType string `json:"content_type"`
			Text        string `json:"text"`
			MediaID     int64  `json:"media_id"`
			Pk          int64  `json:"pk"`
			Type        int    `json:"type"`
		} `json:"comments"`
		DeviceTimestamp      float64 `json:"device_timestamp"`
		CommentCount         int     `json:"comment_count"`
		MediaType            int     `json:"media_type"`
		OrganicTrackingToken string  `json:"organic_tracking_token"`
		CaptionIsEdited      bool    `json:"caption_is_edited"`
		OriginalHeight       int     `json:"original_height"`
		User                 struct {
			Username                   string `json:"username"`
			HasAnonymousProfilePicture bool   `json:"has_anonymous_profile_picture"`
			IsUnpublished              bool   `json:"is_unpublished"`
			FriendshipStatus           struct {
				Following       bool `json:"following"`
				OutgoingRequest bool `json:"outgoing_request"`
			} `json:"friendship_status"`
			ProfilePicURL string `json:"profile_pic_url"`
			IsFavorite    bool   `json:"is_favorite"`
			FullName      string `json:"full_name"`
			Pk            int64  `json:"pk"`
			IsPrivate     bool   `json:"is_private"`
		} `json:"user"`
		Pk              int64       `json:"pk"`
		HasLiked        bool        `json:"has_liked"`
		HasMoreComments bool        `json:"has_more_comments"`
		PhotoOfYou      bool        `json:"photo_of_you"`
		Caption         interface{} `json:"caption"`
		TakenAt         float64     `json:"taken_at"`
		OriginalWidth   int         `json:"original_width"`
		FilterType      int         `json:"filter_type,omitempty"`
		Lng             float64     `json:"lng,omitempty"`
		Lat             float64     `json:"lat,omitempty"`
		Location        struct {
			ExternalSource   string      `json:"external_source"`
			City             string      `json:"city"`
			Name             string      `json:"name"`
			FacebookPlacesID interface{} `json:"facebook_places_id"`
			ExternalID       interface{} `json:"external_id"`
			State            string      `json:"state"`
			Address          string      `json:"address"`
			Lat              float64     `json:"lat"`
			Pk               int         `json:"pk"`
			Lng              float64     `json:"lng"`
			FoursquareV2ID   string      `json:"foursquare_v2_id"`
		} `json:"location,omitempty"`
	} `json:"items"`
	MoreAvailable  bool          `json:"more_available"`
	TotalCount     int           `json:"total_count"`
	RequiresReview bool          `json:"requires_review"`
	NewPhotos      []interface{} `json:"new_photos"`
	Message        string        `json:"message"` // from Error
}

UserTags struct

Jump to

Keyboard shortcuts

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