feed

package
v0.0.0-...-f697b26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch

func Fetch(ctx context.Context, queries *sqlc.Queries, f Feed) error

func RegisterGenerator

func RegisterGenerator(feedType string, generator Generator)

Types

type Feed

type Feed interface {
	Fetch(ctx context.Context, seen SeenFunc) ([]*sqlc.Article, error)
	ReFetch(ctx context.Context, article *sqlc.Article) (*sqlc.Article, error)
}

type Generator

type Generator func(string, json.RawMessage) (Feed, error)

func LookupFeed

func LookupFeed(feedType string) (Generator, bool)

type LobsterResponse

type LobsterResponse struct {
	ShortIDURL  string    `json:"short_id_url"`
	CreatedAt   time.Time `json:"created_at"`
	Title       string    `json:"title"`
	URL         string    `json:"url"`
	Score       int       `json:"score"`
	CommentsURL string    `json:"comments_url"`
}

type Lobsters

type Lobsters struct {
	// contains filtered or unexported fields
}

func (*Lobsters) Fetch

func (s *Lobsters) Fetch(ctx context.Context, seen SeenFunc) ([]*sqlc.Article, error)

func (*Lobsters) ReFetch

func (s *Lobsters) ReFetch(ctx context.Context, a *sqlc.Article) (*sqlc.Article, error)

type RSS

type RSS struct {
	// contains filtered or unexported fields
}

func NewRSSWithConfig

func NewRSSWithConfig(name string, config *RSSConfig) *RSS

func (*RSS) Fetch

func (s *RSS) Fetch(ctx context.Context, seen SeenFunc) ([]*sqlc.Article, error)

func (*RSS) ReFetch

func (s *RSS) ReFetch(ctx context.Context, a *sqlc.Article) (*sqlc.Article, error)

type RSSConfig

type RSSConfig struct {
	URL              string `json:"url"`
	Username         string `json:"username"`
	Password         string `json:"password"`
	FetchLinkContent bool   `json:"fetch_link_content"`
}

type SeenFunc

type SeenFunc func(context.Context, string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL