New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/brandonromano/go-instagram

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/brandonromano/go-instagram

  • v0.0.0-20141201170734-c4fd1be1ff2b
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-instagram

go-instagram is Go library for accessing Instagram REST and Search APIs. This is a fork of https://github.com/gedex/go-instagram . The primary intended difference is that this fork adds support for some elements of the realtime API.

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

Build Status: Build 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.

FAQs

Package last updated on 01 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc