Skip to content

Latest commit

 

History

History
109 lines (69 loc) · 2.45 KB

README.md

File metadata and controls

109 lines (69 loc) · 2.45 KB

goinsta

Golang Instagram API , Unofficial Instagram API for Golang

Build Status GoDoc Go Report Card Coverage Status

Unofficial Instagram API written in Golang

Legal

@mgp25 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.

Very simple and no-dependency Instagram API

This library work like android version of instagram


Installation

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

Methods

There is lot of methods , like uploadPhoto , follow , unfollow , comment , like and etc...

This repository is a copy of Instagram-API-Python , And original source is Instagram-API

How to use ?

The example is very simple !

GetUserFeed

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

	resp, err := insta.UserFeed()
	if err != nil {
		panic(err)
	}

	if resp.Status != "ok" {
		panic("Error occured , " + resp.Status)
	}

	for _, item := range resp.Items {
		if len(item.Caption.Text) > 30 {
			item.Caption.Text = item.Caption.Text[:30]
		}
		fmt.Println(item.ID, item.Caption.Text)
	}
}

UploadPhoto

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

	resp, _ := insta.UploadPhoto("PATH_TO_IMAGE", "CAPTION", insta.NewUploadID(), 87,goinsta.Filter_Lark) // default quality is 87

	fmt.Println(resp.Status)
}

Does goinsta support proxy servers ?

Yes, you may create goinsta object using:

insta := goinsta.NewViaProxy("USERNAME", "PASSWORD", "http://<ip>:<port>")

Thanks

  1. levpasha