Code Monkey home page Code Monkey logo

go-imgur's Introduction

go-imgur

Go GoDoc Go Report Card Coverage Status

Go library to use the imgur.com API. At the moment only the anonymous part of the API is supported, but that is used in a production environment.

Example

To see some simple example code please take a look at the command line client found in imgurcmd/main.go.

go-imgur's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar jbreitbart avatar leon-richardt avatar michaelshobbs 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

Watchers

 avatar  avatar  avatar  avatar

go-imgur's Issues

Remove webm support

Imgur has removed webm, we should also remove it from our data structures.

GetInfoFromURL returns 404 for valid gallery album url

Is it possible this assumption is incorrect?

go-imgur/fromURL.go

Lines 33 to 34 in 712f55b

// https://imgur.com/gallery/<id> len(id) == 5 -> gallery album
// https://imgur.com/gallery/<id> len(id) == 7 -> gallery image

ex url: https://imgur.com/gallery/t6l1GiW (seems like a valid gallery album)

code:
	info, code, err := c.service.GetInfoFromURL("https://imgur.com/gallery/t6l1GiW")
	fmt.Printf("info[%d]: %+v err: %+v\n", code, info, err)
output:
	[22/Apr/2020:19:13:45 +0000] INFO 2020/04/22 19:13:45 Debug: Detected imgur gallery ID t6l1GiW. Was going down the imgur.com/gallery/ path.
	[22/Apr/2020:19:13:45 +0000] INFO 2020/04/22 19:13:45 Info: Requesting URL https://api.imgur.com/3/gallery/image/t6l1GiW
	info[-1]: &{Image:<nil> Album:<nil> GImage:<nil> GAlbum:<nil> Limit:<nil>} err: Problem getting URL for gallery image info ID t6l1GiW - HTTP status indicates an error for https://api.imgur.com/3/gallery/image/t6l1GiW - 404 Not Found

code:
	giinfo, code, err := c.service.GetGalleryImageInfo("t6l1GiW")
	fmt.Printf("giinfo[%d]: %+v err: %+v\n", code, giinfo, err)
output:
	[22/Apr/2020:19:13:45 +0000] INFO 2020/04/22 19:13:45 Info: Requesting URL https://api.imgur.com/3/gallery/image/t6l1GiW
	giinfo[-1]: <nil> err: Problem getting URL for gallery image info ID t6l1GiW - HTTP status indicates an error for https://api.imgur.com/3/gallery/image/t6l1GiW - 404 Not Found

code:
	gainfo, code, err := c.service.GetGalleryAlbumInfo("t6l1GiW")
	fmt.Printf("gainfo[%d]: %+v err: %+v\n", code, gainfo, err)
output:
	[22/Apr/2020:19:13:45 +0000] INFO 2020/04/22 19:13:45 Info: Requesting URL https://api.imgur.com/3/gallery/album/t6l1GiW
	gainfo[200]: &{ID:t6l1GiW Title:Funny Random Meme and Twitter Dump Description: DateTime:1587558857 Cover:60wTouU CoverWidth:1242 CoverHeight:1512 AccountURL:anlyin AccountID:10047121 Privacy:hidden Layout:blog
... snipped for brevity ...
err: <nil>

I noticed that the URLs in fromURL_test.go abide by the ID length logic so it's quite possible I'm missing something. Also, happy to help with a PR but wanted to see if I'm missing something else first.

Upload Multiple Images

Hello,

I am looking through your package api and see client.UploadImage do you just use the same album string to do this? Some documentation could be helpful

Thanks Guys/Gals/Etc! Awesome job

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.