Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 24, 2017 09:59
Show Gist options
  • Save mlabouardy/75c93f28bf86a5ac6c15ef0bad743796 to your computer and use it in GitHub Desktop.
Save mlabouardy/75c93f28bf86a5ac6c15ef0bad743796 to your computer and use it in GitHub Desktop.
9Gag Function Serverless
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"github.com/mlabouardy/9gag"
)
func main() {
tag, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatalf("Unable to read standard input: %s", err.Error())
}
gag9 := gag9.New()
memes := gag9.FindByTag(string(tag))
rawJson, _ := json.Marshal(memes)
fmt.Println(string(rawJson))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment