repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
f00e329
parent
b077673
author
Eric Bower
date
2024-01-22 04:33:21 +0000 UTC
chore: add feeds cmd for testing fetcher
1 files changed,  +22, -0
A cmd/feeds/fetch/main.go
+22, -0
 1@@ -0,0 +1,22 @@
 2+package main
 3+
 4+import (
 5+	"fmt"
 6+
 7+	"github.com/mmcdole/gofeed"
 8+	"github.com/picosh/pico/db/postgres"
 9+	"github.com/picosh/pico/feeds"
10+)
11+
12+func main() {
13+	cfg := feeds.NewConfigSite()
14+	dbh := postgres.NewDB(cfg.DbURL, cfg.Logger)
15+	defer dbh.Close()
16+	fetcher := feeds.NewFetcher(dbh, cfg)
17+	fp := gofeed.NewParser()
18+	feed, err := fetcher.ParseURL(fp, "https://old.reddit.com/r/Watchexchange/.rss")
19+	if err != nil {
20+		panic(err)
21+	}
22+	fmt.Println(feed)
23+}