ekster/pkg/rss/debug.go
Peter Stuifzand 9ef3369389
Some checks failed
continuous-integration/drone/push Build is failing
Cleanup for go modules
2020-07-27 22:09:02 +02:00

40 lines
584 B
Go

// go run debug.go [URL]
// +build ignore
package main
import (
"bytes"
"encoding/json"
"fmt"
"os"
"path/filepath"
"github.com/pstuifzand/go-parse-feed"
)
func main() {
if len(os.Args) != 2 || os.Args[1] == "-h" {
fmt.Fprintf(os.Stderr, "Usage:\n\t%s [URL]\n", filepath.Base(os.Args[0]))
os.Exit(2)
}
feed, err := rss.Fetch(os.Args[1])
if err != nil {
panic(err)
}
raw, err := json.Marshal(feed)
if err != nil {
panic(err)
}
buf := new(bytes.Buffer)
if err := json.Indent(buf, raw, "", "\t"); err != nil {
panic(err)
}
fmt.Println(buf.String())
}