项目作者: ljesparis

项目描述 :
Unofficial instagram client for go
高级语言: Go
项目地址: git://github.com/ljesparis/gostagram.git
创建时间: 2017-08-01T19:03:15Z
项目社区:https://github.com/ljesparis/gostagram

开源协议:MIT License

下载



Gostagram


Unofficial and easy to use instagram client for go.



gostagram documentation
Release
license
Powered By: gostagram



Quick Start.

Create Instagram Client

Go to instagram developer website
and create a developer account, then register a new instagram client.

Implement Oauth2 Protocol

Get the access token, implementing oauth2 authorization protocol.
I do recommmend oauth2 for this job.
Here you can find an oauth2 example.

Download and Installation

  1. go get github.com/ljesparis/gostagram

Usage

Basic example, using an client to
consume an instagram endpoint.

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/ljesparis/gostagram"
  5. )
  6. func main() {
  7. client := gostagram.NewClient("access_token")
  8. user, err := client.GetCurrentUser()
  9. if err != nil {
  10. fmt.Println(err)
  11. } else {
  12. fmt.Println(user.Id)
  13. fmt.Println(user.Username)
  14. fmt.Println(user.FullName)
  15. }
  16. }

If you want to enable instagram signed requests mode
you have to tell gostagram client, that you want to sig
a request.

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/ljesparis/gostagram"
  5. )
  6. func main() {
  7. client := gostagram.NewClient("access_token")
  8. client.SetSignedRequest(true)
  9. client.SetClientSecret("client secret")
  10. tags, err := client.SearchTags("golang")
  11. if err != nil {
  12. fmt.Println(err)
  13. } else {
  14. for _, tag := range tags {
  15. fmt.Println("Tag name: ", tag.Name)
  16. }
  17. }
  18. }

Tests.

Before executing gostagram tests, please get access token, client secret
and complete every empty variable in all test file, why? well, that way you could
test every method with your own parameters, otherwise multiples errors will be
thrown.

Note: test every method one by one, use the makefile to optimize that
process.

Support us.

Contribute.

Please use Github issue tracker
for everything.

  • Report issues.
  • Improve/Fix documentation.
  • Suggest new features or enhancements.

License.

gostagram license MIT