make it so it doesnt crash but just logs output
This commit is contained in:
parent
0dfbeea8d3
commit
96cff5792c
5
main.go
5
main.go
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
"bufio"
|
||||
"strings"
|
||||
|
||||
"github.com/mmcdole/gofeed"
|
||||
)
|
||||
|
@ -23,9 +24,9 @@ func main () {
|
|||
s := bufio.NewScanner(os.Stdin)
|
||||
for s.Scan() {
|
||||
fp := gofeed.NewParser()
|
||||
feed, err := fp.ParseURLWithContext(s.Text(), ctx)
|
||||
feed, err := fp.ParseURLWithContext(strings.TrimSpace(s.Text()), ctx)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Println(err)
|
||||
} else {
|
||||
for _, item := range feed.Items {
|
||||
fmt.Printf("<li><a href=\"%s\">%s</a><p>%s</p></li>\n", item.Link, item.Title, item.Description)
|
||||
|
|
Loading…
Reference in New Issue