repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

pico / cmd / feeds / fetch
Eric Bower  ·  2025-05-25

main.go

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