feedimport

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 34 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultPollInterval = time.Hour
	DefaultTimeout      = 30 * time.Second
	DefaultMaxBodyBytes = 10 << 20
	DefaultConcurrency  = 6
	DefaultUserAgent    = ""
)

Variables

View Source
var ExtensionContentHashWhitelist = map[string]map[string]bool{
	"content": {
		"encoded": true,
	},
	"dc": {
		"creator": true,
	},
	"media": {
		"content":   true,
		"thumbnail": true,
	},
	"markdown": {
		"content": true,
	},
}

Functions

func NewAuditInventory added in v0.7.0

func NewAuditInventory(feeds []store.Feed, userAgent string, allowPrivateNetwork bool) audit.UpstreamInventory

NewAuditInventory constructs a bounded read-only inventory over configured feed rows supplied by the caller's existing query-only snapshot. The public API deliberately exposes no HTTP client, transport, DNS, redirect, or URL override capability.

func NormalizeFeedURL

func NormalizeFeedURL(raw string) (string, string, error)

Types

type AddOptions

type AddOptions struct {
	Enabled             bool
	Disabled            bool
	Import              bool
	PollInterval        time.Duration
	UserTags            string
	Fetch               bool
	DefaultPollInterval time.Duration
	Timeout             time.Duration
	MaxBodyBytes        int64
	UserAgent           string
	AllowPrivateNetwork bool
	Client              *http.Client
	Fetcher             Fetcher
	Now                 func() time.Time
	Logger              *slog.Logger
}

type DiscoveryCandidate

type DiscoveryCandidate struct {
	URL   string `json:"url"`
	Title string `json:"title,omitempty"`
	Type  string `json:"type,omitempty"`
}

func DiscoverFromHTML

func DiscoverFromHTML(pageURL, htmlBody string) ([]DiscoveryCandidate, error)

func DiscoverURL

func DiscoverURL(ctx context.Context, rawURL string, opts AddOptions) ([]DiscoveryCandidate, bool)

type FetchResult

type FetchResult struct {
	RequestURL        string
	FinalURL          string
	HTTPStatus        int
	HeadersJSON       string
	ContentEncoding   string
	DecodedBody       []byte
	DecodedBodyHash   string
	WireResponseBytes []byte
	DecodedSizeBytes  int64
	ETag              string
	LastModified      string
	RetryAfter        time.Time
	NotModified       bool
	UnchangedBody     bool
}

type Fetcher

type Fetcher interface {
	Fetch(ctx context.Context, feed store.Feed, opts Options) (FetchResult, error)
}

type HTTPFetcher

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

func NewHTTPFetcher

func NewHTTPFetcher(client *http.Client) HTTPFetcher

func NewHTTPFetcherWithOptions added in v0.1.7

func NewHTTPFetcherWithOptions(client *http.Client, opts HTTPFetcherOptions) HTTPFetcher

func (HTTPFetcher) Fetch

func (f HTTPFetcher) Fetch(ctx context.Context, feed store.Feed, opts Options) (FetchResult, error)

type HTTPFetcherOptions added in v0.1.7

type HTTPFetcherOptions struct {
	AllowPrivateNetwork bool
}

type Options

type Options struct {
	Limit               int
	Force               bool
	MetadataOnly        bool
	IncludeBlocked      bool
	Concurrency         int
	DefaultPollInterval time.Duration
	Timeout             time.Duration
	MaxBodyBytes        int64
	UserAgent           string
	AllowPrivateNetwork bool
	Client              *http.Client
	Fetcher             Fetcher
	Now                 func() time.Time
	Logger              *slog.Logger
}

type Result

type Result struct {
	FeedKey        string  `json:"feed_key"`
	URL            string  `json:"url"`
	Status         string  `json:"status"`
	HTTPStatus     int     `json:"http_status,omitempty"`
	EntriesSeen    int     `json:"entries_seen"`
	ItemsCreated   int     `json:"items_created"`
	ItemsUpdated   int     `json:"items_updated"`
	ItemsUnchanged int     `json:"items_unchanged"`
	SourceIDs      []int64 `json:"source_ids,omitempty"`
	Error          string  `json:"error,omitempty"`
}

type RunFunc

type RunFunc func(context.Context, config.Config, *store.Store, Options) (Stats, error)

type Stats

type Stats struct {
	FeedsChecked      int      `json:"feeds_checked"`
	FeedsChanged      int      `json:"feeds_changed"`
	FeedsUnchanged    int      `json:"feeds_unchanged"`
	FeedsFailed       int      `json:"feeds_failed"`
	EntriesSeen       int      `json:"entries_seen"`
	ItemsCreated      int      `json:"items_created"`
	ItemsUpdated      int      `json:"items_updated"`
	ItemsUnchanged    int      `json:"items_unchanged"`
	VersionsCreated   int      `json:"versions_created"`
	SourcesCreated    int      `json:"sources_created"`
	SourcesLinked     int      `json:"sources_linked"`
	SourceIDs         []int64  `json:"source_ids,omitempty"`
	ItemsRendered     int      `json:"items_rendered"`
	IdentityConflicts int      `json:"identity_conflicts"`
	Errors            int      `json:"errors"`
	Results           []Result `json:"results,omitempty"`
}

func Add

func Add(ctx context.Context, cfg config.Config, st *store.Store, rawURL string, opts AddOptions) (store.Feed, bool, Stats, error)

func CheckFeed

func CheckFeed(ctx context.Context, cfg config.Config, st *store.Store, feed store.Feed, opts Options) (Stats, error)

func Run

func Run(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Stats, error)

Jump to

Keyboard shortcuts

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