Coder Social home page Coder Social logo

go-instagram's Introduction

go-instagram

go-instagram is Go library for accessing Instagram REST and Search APIs.

Documentation: http://godoc.org/github.com/gedex/go-instagram/instagram

Build Status: Build Status Build Status Coverage Status

Basic Usage

Access different parts of the Instagram API using the various services on a Instagram Client:

// You can optionally pass your own HTTP's client, otherwise pass it with nil.
client := instagram.NewClient(nil)

You can then optionally set ClientID, ClientSecret and AccessToken:

client.ClientID = "8f2c0ad697ea4094beb2b1753b7cde9c"

With client object set, you can communicate with Instagram endpoints:

// Gets the most recent media published by a user with id "3"
media, next, err := client.Users.RecentMedia("3", nil)

Set optional parameters for an API method by passing an Parameters object.

// Gets user's feed.
opt := &instagram.Parameters{Count: 3}
media, next, err := client.Users.RecentMedia("3", opt)

Please see examples/example.go for a complete example.

Data Retrieval

The methods which return slice in first return value will return three values (data, pagination, and error). Here's an example of retrieving popular media:

media, next, err := client.Media.Popular()
if err != nil {
	fmt.Fprintf(os.Stderr, "Error: %v\n", err)
}
for _, m := range media {
	fmt.Printf("ID: %v, Type: %v\n", m.ID, m.Type)
}
if next.NextURL != "" {
	fmt.Println("Next URL", next.NextURL)
}

If a single type is returned in first return value, then only two values returned. Here's an example of retrieving user's information:

user, err := client.Users.Get("3")
if err != nil {
	fmt.Fprintf(os.Stderr, "Error: %v\n", err)
}
fmt.Println("Username", user.Username)

Credits

License

This library is distributed under the BSD-style license found in the LICENSE file.

go-instagram's People

Contributors

dagoof avatar gedex avatar kirs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-instagram's Issues

Deserializing media fails

If the response contains a media that has a user tagged on it (at some coordinate) it returns the following error:

instagram: error while retrieving recent media: json: cannot unmarshal object key "y" into unexported field y of type instagram.UserInPhotoPosition

How to get second page in any paginated request?

ResponsePagination object is basically an URL of which this library doesn't take as an input at any point.

So do I need to initialize HTTP client to make use of pagination URL and do the deserialization myself? Then what's the point of this library at all?

If there's a way to paginate requests in this library, please consider documenting them.

Multibyte support?

Hi I have gotten your bindings to work. But I'm Having trouble with multibyte suport. Is this a known issue and what would be needed to resolve it?

Playing video

Great code, thanks. However, I cannot play a video. There is no example in your code for it and nothing to be found on the internet. Can you provide an example? It seems that video's are simply not playable. Thanks.

Add Pagination to RelationshipsService.Follows function

What is the recommended way to iterate through a paginated list of Followers? This method returns pagination, but I don't see a way to pass the "cursor" parameter back into the method:

func (s *RelationshipsService) Follows(userId string) ([]User, *ResponsePagination, error)

Using a pagination mechanism similar to the RecentMedia function would be idea.

func (s *UsersService) RecentMedia(userId string, opt *Parameters) ([]Media, *ResponsePagination, error)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.