rss/debug.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// go run debug.go [URL] //go:build ignore // +build ignore package main import ( "bytes" "encoding/json" "fmt" "os" "path/filepath" "git.j3s.sh/vore/rss" ) 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()) }