gag9

package module
v0.0.0-...-38043a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 6 Imported by: 0

README

9GAG API in Go

CircleCI Go Report Card MIT License

Installing

go get
$ go get -u github.com/mlabouardy/9gag

Example

Getting top memes
package main

import (
	"fmt"
	"github.com/mlabouardy/9gag"
)

func main() {
	gag9 := gag9.New()
	for _, meme := range gag9.Find() {
		fmt.Printf("Description: %s\nImage: %s\n", meme.Description, meme.Image)
	}
}
Filter by tag name
package main

import (
	"fmt"
	"github.com/mlabouardy/9gag"
)

func main() {
	gag9 := gag9.New()
	for _, meme := range gag9.FindByTag("got") {
		fmt.Printf("Description: %s\nImage: %s\n", meme.Description, meme.Image)
	}
}

How to use

http://www.blog.labouardy.com/create-9gag-android-application/

Contributing

You are more than welcome to contribute to this project. Fork and make a Pull Request, or create an Issue if you see any problem.

Documentation

Index

Constants

View Source
const (
	GAG9_URL   = "https://9gag.com"
	IMG_URL    = "https://img-9gag-fun.9cache.com/photo/%s_460s.jpg"
	ANCHOR_TAG = "a"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gag9

type Gag9 struct {
	// contains filtered or unexported fields
}

func New

func New() *Gag9

func (*Gag9) Find

func (g *Gag9) Find() []Meme

func (*Gag9) FindByTag

func (g *Gag9) FindByTag(tag string) []Meme

type Meme

type Meme struct {
	Description string
	Image       string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL