Skip to content
/ go-xkcd Public

xkcd downloads and prints json of an xkcd comic given its number

Notifications You must be signed in to change notification settings

waseem/go-xkcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

go-xkcd

xkcd downloads and prints json of an xkcd comic given its number.

Usage

package main

import (
    "fmt"
    "log"
    "os"
    "github.com/waseem/go-xkcd"
    )

func main() {
  comic, err := xkcd.GetComic(os.Args[1])
    if err != nil {
      log.Fatal(err)
    }

  fmt.Printf("Comic: %d\n", comic.Num)
    fmt.Printf("+----------+\n\n")
    fmt.Printf("Title: %s\n", comic.Title)
    fmt.Printf("Safe Title: %s\n", comic.SafeTitle)
    fmt.Printf("Transcript: %s\n", comic.Transcript)
    fmt.Printf("Alt: %s\n", comic.Alt)
    fmt.Printf("Image: %s\n", comic.Img)
    fmt.Printf("Link: %s\n", comic.Link)
    fmt.Printf("Date: %s-%s-%s\n", comic.Year, comic.Month, comic.Day)
    fmt.Printf("News: %s\n", comic.News)
}

xkcd.GetComic(0) will return the latest published comic.

About

xkcd downloads and prints json of an xkcd comic given its number

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages