goinsta

package module
v1.0.0-...-e2e0fcb Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: MIT Imports: 22 Imported by: 0

README

GoInsta !

Golang Instagram API , Unofficial Instagram API for Golang

Build Status GoDoc Go Report Card Coverage Status

Features

  • Like Instagram mobile application. Goinsta is very similar to Instagram official application.
  • Simple. Goinsta is made by a lazy programmer!
  • Backup methods. You can use store package to export/import goinsta.Instagram struct.
  • No External Dependencies. Goinsta will not use any Go packages outside of the standard library.

Installation

go get -u -v github.com/ahmdrz/goinsta

Example

package main

import (
	"fmt"

	"github.com/ahmdrz/goinsta"
)

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

	if err := insta.Login(); err != nil {
		panic(err)
	}

	defer insta.Logout()

	...
}

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.

Contributors ❤


GhostRussia

sourcesoft

icholy

rakd

kemics

sklinkert

vitaliikapliuk

glebtv

neetkee

daciwei

aaronarduino

tggo

Albina-art

maniack


hadidimad

themester

hadidimad

zhuharev

Donate

Bitcoin : 1KjcfrBPJtM4MfBSGTqpC6RcoEW1KBh15X

Analytics

Documentation

Overview

goinsta project goinsta.go

Index

Constants

View Source
const (
	Filter_Walden           = 20
	Filter_Crema            = 616
	Filter_Reyes            = 614
	Filter_Moon             = 111
	Filter_Ashby            = 116
	Filter_Maven            = 118
	Filter_Brannan          = 22
	Filter_Hefe             = 21
	Filter_Valencia         = 25
	Filter_Clarendon        = 112
	Filter_Helena           = 117
	Filter_Brooklyn         = 115
	Filter_Dogpatch         = 105
	Filter_Ludwig           = 603
	Filter_Stinson          = 109
	Filter_Inkwell          = 10
	Filter_Rise             = 23
	Filter_Perpetua         = 608
	Filter_Juno             = 613
	Filter_Charmes          = 108
	Filter_Ginza            = 107
	Filter_Hudson           = 26
	Filter_Normat           = 0
	Filter_Slumber          = 605
	Filter_Lark             = 615
	Filter_Skyline          = 113
	Filter_Kelvin           = 16
	Filter_1977             = 14
	Filter_Lo_Fi            = 2
	Filter_Aden             = 612
	Filter_Amaro            = 24
	Filter_Sutro            = 18
	Filter_Vasper           = 106
	Filter_Nashville        = 15
	Filter_X_Pro_II         = 1
	Filter_Mayfair          = 17
	Filter_Toaster          = 19
	Filter_Earlybird        = 3
	Filter_Willow           = 28
	Filter_Sierra           = 27
	Filter_Gingham          = 114
	GOINSTA_API_URL         = "https://i.instagram.com/api/v1/"
	GOINSTA_USER_AGENT      = "Instagram 10.26.0 Android (18/4.3; 320dpi; 720x1280; Xiaomi; HM 1SW; armani; qcom; en_US)"
	GOINSTA_IG_SIG_KEY      = "4f8732eb9ba7d1c8e8897a75d6474d4eb3f5279137431b2aafb71fafe2abe178"
	GOINSTA_EXPERIMENTS     = "" /* 12761-byte string literal not displayed */
	GOINSTA_SIG_KEY_VERSION = "4"
)

Const values , GOINSTA Default variables contains API url , user agent and etc... GOINSTA_IG_SIG_KEY is Instagram sign key, It's important Filter_<name>

View Source
const Base64UrlCharmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"

Base64UrlCharmap - all posible characters

Variables

View Source
var GOINSTA_DEVICE_SETTINGS = map[string]interface{}{
	"manufacturer":    "Xiaomi",
	"model":           "HM 1SW",
	"android_version": 18,
	"android_release": "4.3",
}

GOINSTA_DEVICE_SETTINGS variable is a simulate of an android device

Functions

func MediaFromCode

func MediaFromCode(code string) string

Types

type BackupType

type BackupType struct {
	Cookies []http.Cookie
	InstaType
}

type Informations

type Informations struct {
	Username  string
	Password  string
	DeviceID  string
	UUID      string
	RankToken string
	Token     string
	PhoneID   string
}

type InstaType

type InstaType struct {
	IsLoggedIn   bool
	Informations Informations
	LoggedInUser response.User
	// contains filtered or unexported fields
}

type Instagram

type Instagram struct {
	Cookiejar *cookiejar.Jar
	InstaType
}

func New

func New(username, password string) *Instagram

New try to fill Instagram struct New does not try to login , it will only fill Instagram struct

func NewViaProxy

func NewViaProxy(username, password, proxy string) *Instagram

NewViaProxy All requests will use proxy server (example http://<ip>:<port>)

func (*Instagram) AutoCompleteUserList

func (insta *Instagram) AutoCompleteUserList() error

AutoCompleteUserList simulates Instagram app behavior

func (*Instagram) Block

func (insta *Instagram) Block(userID int64) ([]byte, error)

func (*Instagram) ChangePassword

func (insta *Instagram) ChangePassword(newpassword string) ([]byte, error)

func (*Instagram) Comment

func (insta *Instagram) Comment(mediaID, text string) ([]byte, error)

func (*Instagram) DeleteComment

func (insta *Instagram) DeleteComment(mediaID, commentID string) ([]byte, error)

func (*Instagram) DeleteMedia

func (insta *Instagram) DeleteMedia(mediaID string) ([]byte, error)

func (*Instagram) DirectMessage

func (insta *Instagram) DirectMessage(recipient string, message string) (response.DirectMessageResponse, error)

func (*Instagram) EditMedia

func (insta *Instagram) EditMedia(mediaID string, caption string) ([]byte, error)

func (*Instagram) Explore

func (insta *Instagram) Explore() (response.ExploreResponse, error)

func (*Instagram) Expose

func (insta *Instagram) Expose() error

Expose , expose instagram return error if status was not 'ok' or runtime error

func (*Instagram) Follow

func (insta *Instagram) Follow(userID int64) (response.FollowResponse, error)

Follow one of instagram users with userID , you can find userID in GetUsername

func (*Instagram) GetDirectPendingRequests

func (insta *Instagram) GetDirectPendingRequests() (response.DirectPendingRequests, error)

func (*Instagram) GetDirectThread

func (insta *Instagram) GetDirectThread(threadid string) (response.DirectThread, error)

func (*Instagram) GetFollowingRecentActivity

func (insta *Instagram) GetFollowingRecentActivity() (response.FollowingRecentActivityResponse, error)

func (*Instagram) GetLocationFeed

func (insta *Instagram) GetLocationFeed(locationID int64, maxID string) (response.LocationFeedResponse, error)

GetLocationFeed return location feed data by locationID in Instagram

func (*Instagram) GetPopularFeed

func (insta *Instagram) GetPopularFeed() (response.GetPopularFeedResponse, error)

func (*Instagram) GetProfileData

func (insta *Instagram) GetProfileData() (response.ProfileDataResponse, error)

GetProfileData return current user information

func (*Instagram) GetRankedRecipients

func (insta *Instagram) GetRankedRecipients() (response.DirectRankedRecipients, error)

func (*Instagram) GetRecentActivity

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

func (*Instagram) GetRecentRecipients

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

func (*Instagram) GetReelsTrayFeed

func (insta *Instagram) GetReelsTrayFeed() (response.TrayResponse, error)

GetTrayFeeds - Get all available Instagram stories of your friends

func (*Instagram) GetSessions

func (insta *Instagram) GetSessions(url *url.URL) []*http.Cookie

GetSessions return current instagram session and cookies Maybe need for webpages that use this API

func (*Instagram) GetTagRelated

func (insta *Instagram) GetTagRelated(tag string) (response.TagRelatedResponse, error)

GetTagRelated can get related tags by tags in instagram

func (*Instagram) GetUserByID

func (insta *Instagram) GetUserByID(userID int64) (response.GetUsernameResponse, error)

GetuserID return information of a user by user ID

func (*Instagram) GetUserByUsername

func (insta *Instagram) GetUserByUsername(username string) (response.GetUsernameResponse, error)

GetUsername return information of a user by username

func (*Instagram) GetUserStories

func (insta *Instagram) GetUserStories(userID int64) (response.StoryResponse, error)

GetUserStories - Get all available Instagram stories for the given user id

func (*Instagram) GetV2Inbox

func (insta *Instagram) GetV2Inbox() (response.DirectListResponse, error)

func (*Instagram) LatestFeed

func (insta *Instagram) LatestFeed() (response.UserFeedResponse, error)

LatestFeed - Get the latest page of your own Instagram feed.

func (*Instagram) LatestUserFeed

func (insta *Instagram) LatestUserFeed(userID int64) (response.UserFeedResponse, error)

LatestUserFeed - Get the latest Instagram feed for the given user id

func (*Instagram) Like

func (insta *Instagram) Like(mediaID string) ([]byte, error)

func (*Instagram) Login

func (insta *Instagram) Login() error

Login to Instagram. return error if can't send request to instagram server

func (*Instagram) Logout

func (insta *Instagram) Logout() error

Logout of Instagram

func (*Instagram) MediaComments

func (insta *Instagram) MediaComments(mediaID string, maxID string) (response.MediaCommentsResponse, error)

MediaComments - Returns comments of a media, input is mediaid of a media You can use maxID for pagination, otherwise leave it empty to get the latest page only.

func (*Instagram) MediaInfo

func (insta *Instagram) MediaInfo(mediaID string) (response.MediaInfoResponse, error)

MediaInfo return media information

func (*Instagram) MediaLikers

func (insta *Instagram) MediaLikers(mediaID string) (response.MediaLikersResponse, error)

MediaLikers return likers of a media , input is mediaid of a media

func (*Instagram) MegaphoneLog

func (insta *Instagram) MegaphoneLog() error

MegaphoneLog simulates Instagram app behavior

func (*Instagram) NewUploadID

func (insta *Instagram) NewUploadID() int64

NewUploadID return unix nano time

func (*Instagram) OptionalRequest

func (insta *Instagram) OptionalRequest(endpoint string, a ...interface{}) (body []byte, err error)

func (*Instagram) RemoveProfilePicture

func (insta *Instagram) RemoveProfilePicture() (response.ProfileDataResponse, error)

RemoveProfilePicture will remove current logged in user profile picture

func (*Instagram) RemoveSelfTag

func (insta *Instagram) RemoveSelfTag(mediaID string) ([]byte, error)

func (*Instagram) SearchFacebookUsers

func (insta *Instagram) SearchFacebookUsers(query string) ([]byte, error)

func (*Instagram) SearchLocation

func (insta *Instagram) SearchLocation(lat, lng, search string) (response.SearchLocationResponse, error)

SearchLocation return search location by lat & lng & search query in instagram

func (*Instagram) SearchTags

func (insta *Instagram) SearchTags(query string) (response.SearchTagsResponse, error)

func (*Instagram) SearchUsername

func (insta *Instagram) SearchUsername(query string) (response.SearchUserResponse, error)

func (*Instagram) SelfTotalUserFollowers

func (insta *Instagram) SelfTotalUserFollowers() (response.UsersResponse, error)

func (*Instagram) SelfTotalUserFollowing

func (insta *Instagram) SelfTotalUserFollowing() (response.UsersResponse, error)

func (*Instagram) SelfUserFollowers

func (insta *Instagram) SelfUserFollowers(maxID string) (response.UsersResponse, error)

func (*Instagram) SelfUserFollowing

func (insta *Instagram) SelfUserFollowing(maxID string) (response.UsersResponse, error)

func (*Instagram) SetCookies

func (insta *Instagram) SetCookies(url *url.URL, cookies []*http.Cookie) error

SetCookies can enable us to set cookie, it'll be help for webpage that use this API without Login-again.

func (*Instagram) SetPrivateAccount

func (insta *Instagram) SetPrivateAccount() (response.ProfileDataResponse, error)

SetPrivateAccount Sets account to private

func (*Instagram) SetPublicAccount

func (insta *Instagram) SetPublicAccount() (response.ProfileDataResponse, error)

SetPublicAccount Sets account to public

func (*Instagram) SyncFeatures

func (insta *Instagram) SyncFeatures() error

SyncFeatures simulates Instagram app behavior

func (*Instagram) TagFeed

func (insta *Instagram) TagFeed(tag string) (response.TagFeedsResponse, error)

TagFeed search by tags in instagram

func (*Instagram) Timeline

func (insta *Instagram) Timeline(maxID string) (r response.FeedsResponse, err error)

func (*Instagram) TotalUserFollowers

func (insta *Instagram) TotalUserFollowers(userID int64) (response.UsersResponse, error)

func (*Instagram) TotalUserFollowing

func (insta *Instagram) TotalUserFollowing(userID int64) (response.UsersResponse, error)

func (*Instagram) UnBlock

func (insta *Instagram) UnBlock(userID int64) ([]byte, error)

func (*Instagram) UnFollow

func (insta *Instagram) UnFollow(userID int64) (response.UnFollowResponse, error)

UnFollow one of instagram users with userID , you can find userID in GetUsername

func (*Instagram) UnLike

func (insta *Instagram) UnLike(mediaID string) ([]byte, error)

func (*Instagram) UploadPhoto

func (insta *Instagram) UploadPhoto(photo_path string, photo_caption string, upload_id int64, quality int, filter_type int) (response.UploadPhotoResponse, error)

UploadPhoto can upload your photo file, stored in filesystem with any quality , better to use 87

func (*Instagram) UploadPhotoFromReader

func (insta *Instagram) UploadPhotoFromReader(photo io.Reader, photo_caption string, upload_id int64, quality int, filter_type int) (response.UploadPhotoResponse, error)

UploadPhotoFromReader can upload your photo stored in io.Reader with any quality , better to use 87

func (*Instagram) UserFeed

func (insta *Instagram) UserFeed(userID int64, maxID, minTimestamp string) (response.UserFeedResponse, error)

UserFeed - Returns the Instagram feed for the given user id. You can use maxID and minTimestamp for pagination, otherwise leave them empty to get the latest page only.

func (*Instagram) UserFollowers

func (insta *Instagram) UserFollowers(userID int64, maxID string) (response.UsersResponse, error)

UserFollowers return followers of specific user skip maxid with empty string for get first page

func (*Instagram) UserFollowing

func (insta *Instagram) UserFollowing(userID int64, maxID string) (response.UsersResponse, error)

UserFollowing return followings of specific user skip maxid with empty string for get first page

func (*Instagram) UserFriendShip

func (insta *Instagram) UserFriendShip(userID int64) (response.UserFriendShipResponse, error)

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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