instabot

package module
v0.0.0-...-62d79da Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: MIT Imports: 19 Imported by: 0

README

Instabot

Unofficial Instagram's private API written in Golang, inspired by Python instabot.

Features

  • Account login/logout, two-factor authentication supported.
  • Post/delete a photo or an album to/from your feed.
  • Like/unlike posts.
  • Get post comments.
  • Post/reply/delete comments.
  • Like/unlike comments.
  • Follow/unfollow users.
  • Easily extend APIs by yourself.
  • And more...

Install

go get -u github.com/winterssy/instabot

Usage

import "github.com/winterssy/instabot"

Quick Start

bot := instabot.New("YOUR_USERNAME", "YOUR_PASSWORD")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

_, err := bot.Login(ctx, true)
if err != nil {
    log.Fatal(err)
}

data, err := bot.GetMe(ctx)
if err != nil {
    log.Fatal(err)
}
fmt.Println(data)

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTwoFactorRequired = errors.New("two-factor authentication required")
	ErrChallengeRequired = errors.New("challenge required")
	ErrFeedbackRequired  = errors.New("feedback required")
)

Functions

func GenerateSignedForm

func GenerateSignedForm(form ghttp.Form) ghttp.Form

func GenerateUUID

func GenerateUUID() string

Types

type Bot

type Bot struct {
	Client   *ghttp.Client `json:"-"`
	Username string        `json:"username"`
	Password string        `json:"password"`
	// contains filtered or unexported fields
}

func New

func New(username string, password string) *Bot

func (*Bot) ArchiveMedia

func (bot *Bot) ArchiveMedia(ctx context.Context, mediaId string, undo bool) (ghttp.H, error)

func (*Bot) BlockUser

func (bot *Bot) BlockUser(ctx context.Context, userId string, undo bool) (ghttp.H, error)

func (*Bot) ConfigureMedia

func (bot *Bot) ConfigureMedia(ctx context.Context, uploadId string,
	caption string, disableComments bool) (ghttp.H, error)

func (*Bot) ConfigureSidecarMedia

func (bot *Bot) ConfigureSidecarMedia(ctx context.Context, uploadIds []string, caption string,
	disableComments bool) (ghttp.H, error)

func (*Bot) CreateCollection

func (bot *Bot) CreateCollection(ctx context.Context, name string) (ghttp.H, error)

func (*Bot) DeleteCollection

func (bot *Bot) DeleteCollection(ctx context.Context, collectionId string) (ghttp.H, error)

func (*Bot) DeleteMedia

func (bot *Bot) DeleteMedia(ctx context.Context, mediaId string) (ghttp.H, error)

func (*Bot) DeleteMediaComments

func (bot *Bot) DeleteMediaComments(ctx context.Context, mediaId string, commentIds ...string) (ghttp.H, error)

func (*Bot) DisableMediaComments

func (bot *Bot) DisableMediaComments(ctx context.Context, mediaId string, undo bool) (ghttp.H, error)

func (*Bot) EditCollection

func (bot *Bot) EditCollection(ctx context.Context, collectionId string, name string) (ghttp.H, error)

func (*Bot) EditMedia

func (bot *Bot) EditMedia(ctx context.Context, mediaId string, captionText string) (ghttp.H, error)

func (*Bot) Explore

func (bot *Bot) Explore(ctx context.Context) (ghttp.H, error)

func (*Bot) ExploreCluster

func (bot *Bot) ExploreCluster(ctx context.Context, clusterId string, maxId string) (ghttp.H, error)

func (*Bot) FollowTag

func (bot *Bot) FollowTag(ctx context.Context, name string, undo bool) (ghttp.H, error)

func (*Bot) FollowUser

func (bot *Bot) FollowUser(ctx context.Context, userId string, undo bool) (ghttp.H, error)

func (*Bot) GetCSRFToken

func (bot *Bot) GetCSRFToken() string

func (*Bot) GetCollections

func (bot *Bot) GetCollections(ctx context.Context) (ghttp.H, error)

func (*Bot) GetDeviceId

func (bot *Bot) GetDeviceId() string

func (*Bot) GetMe

func (bot *Bot) GetMe(ctx context.Context) (ghttp.H, error)

func (*Bot) GetMediaComments

func (bot *Bot) GetMediaComments(ctx context.Context, mediaId string) (ghttp.H, error)

func (*Bot) GetRecentSearches

func (bot *Bot) GetRecentSearches(ctx context.Context) (ghttp.H, error)

func (*Bot) GetSelfFeed

func (bot *Bot) GetSelfFeed(ctx context.Context, maxId string) (ghttp.H, error)

func (*Bot) GetSelfFollowers

func (bot *Bot) GetSelfFollowers(ctx context.Context, maxId string) (ghttp.H, error)

func (*Bot) GetSelfFollowings

func (bot *Bot) GetSelfFollowings(ctx context.Context, maxId string) (ghttp.H, error)

func (*Bot) GetSelfTags

func (bot *Bot) GetSelfTags(ctx context.Context) (ghttp.H, error)

func (*Bot) GetSuggestedSearches

func (bot *Bot) GetSuggestedSearches(ctx context.Context, _type string) (ghttp.H, error)

func (*Bot) GetTagInfo

func (bot *Bot) GetTagInfo(ctx context.Context, name string) (ghttp.H, error)

func (*Bot) GetTagSections

func (bot *Bot) GetTagSections(ctx context.Context, name string, tab string, page int) (ghttp.H, error)

supported_tabs: ["top","recent"]

func (*Bot) GetTagStory

func (bot *Bot) GetTagStory(ctx context.Context, name string) (ghttp.H, error)

func (*Bot) GetTimeline

func (bot *Bot) GetTimeline(ctx context.Context, maxId string) (ghttp.H, error)

func (*Bot) GetTopSearches

func (bot *Bot) GetTopSearches(ctx context.Context, query string, count int) (ghttp.H, error)

func (*Bot) GetUUID

func (bot *Bot) GetUUID() string

func (*Bot) GetUserById

func (bot *Bot) GetUserById(ctx context.Context, userId string) (ghttp.H, error)

func (*Bot) GetUserByName

func (bot *Bot) GetUserByName(ctx context.Context, username string) (ghttp.H, error)

func (*Bot) GetUserFeed

func (bot *Bot) GetUserFeed(ctx context.Context, userId string, maxId string) (ghttp.H, error)

func (*Bot) GetUserFollowers

func (bot *Bot) GetUserFollowers(ctx context.Context, userId string, maxId string) (ghttp.H, error)

func (*Bot) GetUserFollowings

func (bot *Bot) GetUserFollowings(ctx context.Context, userId string, maxId string) (ghttp.H, error)

func (*Bot) GetUserFriendship

func (bot *Bot) GetUserFriendship(ctx context.Context, userId string) (ghttp.H, error)

func (*Bot) GetUserId

func (bot *Bot) GetUserId() string

func (*Bot) GetUserTags

func (bot *Bot) GetUserTags(ctx context.Context, userId string) (ghttp.H, error)

func (*Bot) LikeMedia

func (bot *Bot) LikeMedia(ctx context.Context, mediaId string, undo bool) (ghttp.H, error)

func (*Bot) LikeMediaComment

func (bot *Bot) LikeMediaComment(ctx context.Context, commentId string, undo bool) (ghttp.H, error)

func (*Bot) Login

func (bot *Bot) Login(ctx context.Context, interactive bool) (ghttp.H, error)

func (*Bot) Logout

func (bot *Bot) Logout(ctx context.Context) (ghttp.H, error)

func (*Bot) PostAlbum

func (bot *Bot) PostAlbum(ctx context.Context, imageFiles []string, caption string,
	disableComments bool) (ghttp.H, error)

func (*Bot) PostPhoto

func (bot *Bot) PostPhoto(ctx context.Context, imageFile string, caption string,
	disableComments bool) (ghttp.H, error)

func (*Bot) ReplyMediaComment

func (bot *Bot) ReplyMediaComment(ctx context.Context, mediaId string, commentId string,
	commentText string) (ghttp.H, error)

func (*Bot) SaveMedia

func (bot *Bot) SaveMedia(ctx context.Context, mediaId string, undo bool) (ghttp.H, error)

func (*Bot) SaveMediaToCollections

func (bot *Bot) SaveMediaToCollections(ctx context.Context, mediaId string, undo bool,
	collectionIds ...string) (ghttp.H, error)

func (*Bot) SearchPlaces

func (bot *Bot) SearchPlaces(ctx context.Context, query string, count int) (ghttp.H, error)

func (*Bot) SearchTags

func (bot *Bot) SearchTags(ctx context.Context, query string, count int) (ghttp.H, error)

func (*Bot) SearchUser

func (bot *Bot) SearchUser(ctx context.Context, query string, count int) (ghttp.H, error)

func (*Bot) SendMediaComment

func (bot *Bot) SendMediaComment(ctx context.Context, mediaId string, commentText string) (ghttp.H, error)

func (*Bot) SendRequest

func (bot *Bot) SendRequest(req *ghttp.Request) *ghttp.Response

func (*Bot) SetAccountBiography

func (bot *Bot) SetAccountBiography(ctx context.Context, biography string) (ghttp.H, error)

func (*Bot) SetAccountGender

func (bot *Bot) SetAccountGender(ctx context.Context, gender string) (ghttp.H, error)

func (*Bot) SetAccountPrivate

func (bot *Bot) SetAccountPrivate(ctx context.Context, undo bool) (ghttp.H, error)

func (*Bot) TwoFactorLogin

func (bot *Bot) TwoFactorLogin(ctx context.Context, twoFactorId string, twoFactorCode string) (ghttp.H, error)

func (*Bot) UploadPhoto

func (bot *Bot) UploadPhoto(ctx context.Context, r io.Reader, isSidecar bool) (ghttp.H, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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