source

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterArticlesByWordDenylist added in v0.3.0

func FilterArticlesByWordDenylist(articles []*models.Article, denylist []string) []*models.Article

FilterArticlesByWordDenylist filters out articles that contain any of the denylisted words in their title, content, or summary. The comparison is case-insensitive. Returns a new slice containing only the articles that don't match any denylisted words.

func List

func List() []string

List returns a list of available source names.

Types

type Source

type Source interface {
	// Name returns a unique identifier for this source
	Name() string

	// Fetch retrieves articles from the source
	Fetch(ctx context.Context, fetcher fetcher.Fetcher) ([]*models.Article, error)

	// Configure sets up the source with configuration parameters
	Configure(config map[string]any) error
}

Source defines the interface that all content sources must implement.

func New

func New(name string) (Source, error)

New returns a new instance of the specified source.

type SourceConfig

type SourceConfig struct {
	// Type identifies the source implementation to use
	Type string `toml:"type"`

	// Enabled determines if this source should be processed
	Enabled bool `toml:"enabled"`

	// MaxArticles limits the number of articles to include from this source
	MaxArticles int `toml:"max_articles"`

	// WordDenylist contains words that will cause articles to be filtered out
	WordDenylist []string `toml:"word_denylist"`

	// FetcherConfig contains configuration for the fetcher
	FetcherConfig *fetcher.FetcherConfig `toml:"fetcher_config"`

	// ProcessorConfig contains configuration for the processor
	ProcessorConfig *processor.ProcessorConfig `toml:"processor_config"`

	// Options contains source-specific configuration
	Options map[string]any `toml:"options"`
}

SourceConfig contains configuration for a single source.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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