repos / pico

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

pico / cmd / feeds / fetch
Eric Bower · 22 Jan 24

main.go

 1package main
 2
 3import (
 4	"fmt"
 5
 6	"github.com/mmcdole/gofeed"
 7	"github.com/picosh/pico/db/postgres"
 8	"github.com/picosh/pico/feeds"
 9)
10
11func main() {
12	cfg := feeds.NewConfigSite()
13	dbh := postgres.NewDB(cfg.DbURL, cfg.Logger)
14	defer dbh.Close()
15	fetcher := feeds.NewFetcher(dbh, cfg)
16	fp := gofeed.NewParser()
17	feed, err := fetcher.ParseURL(fp, "https://old.reddit.com/r/Watchexchange/.rss")
18	if err != nil {
19		panic(err)
20	}
21	fmt.Println(feed)
22}