Created
October 24, 2017 09:59
-
-
Save mlabouardy/75c93f28bf86a5ac6c15ef0bad743796 to your computer and use it in GitHub Desktop.
9Gag Function Serverless
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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