parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUpstreamBlocked = errors.New("request blocked by upstream bot protection")

Functions

func FeedToText

func FeedToText(f *feeds.Feed) string

func GetFileTypeFromUrl

func GetFileTypeFromUrl(url string) string

func GetGuid

func GetGuid(ss []string) string

func GetLatestDate

func GetLatestDate(dates []time.Time) time.Time

func GetRemoteFileLastModified

func GetRemoteFileLastModified(url string) (time.Time, error)

func HttpGet

func HttpGet(url string, options map[string]any) (*http.Response, error)

func HttpGetUtls

func HttpGetUtls(url string, options map[string]any) (*http.Response, error)

func IsBotChallenge

func IsBotChallenge(resp *http.Response) bool

func IsImageType

func IsImageType(t string) bool

func Route

func Route(g *gin.Engine, p Parser, o *Options) gin.IRoutes

func ServeFeed

func ServeFeed(c *gin.Context, f *feeds.Feed)

func SortFeedEntries

func SortFeedEntries(f *feeds.Feed)

func ValidateURLHost

func ValidateURLHost(rawURL string, allowedHosts []string) error

Types

type InternalError

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

func NewInternalError

func NewInternalError(message string) *InternalError

func WrapInternalError

func WrapInternalError(err error, message string) *InternalError

func (*InternalError) Error

func (e *InternalError) Error() string

func (*InternalError) Unwrap

func (e *InternalError) Unwrap() error

type NotFoundError

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

func NewNotFoundError

func NewNotFoundError(message string) *NotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type Option

type Option struct {
	Flag      string      `json:"flag"`
	Value     interface{} `json:"-"`
	Required  bool        `json:"required"`
	Default   string      `json:"default"`
	Help      string      `json:"help"`
	ShortFlag string      `json:"shortFlag"`
	Type      string      `json:"type"`
	IsPath    bool        `json:"isPath"`
	IsStatic  bool        `json:"isStatic"` // static options are exposed through the API
}

type Options

type Options struct {
	OptionsList OptionsList
	Parser      Parser
}

func GetFullOptions

func GetFullOptions(p Parser) *Options

func (Options) AddFlags

func (o Options) AddFlags(f *flag.FlagSet)

func (*Options) GeWithDefaultFlag

func (o *Options) GeWithDefaultFlag(key string) (interface{}, bool)

func (*Options) Get

func (o *Options) Get(key string) interface{}

func (*Options) GetBool

func (o *Options) GetBool(key string) bool

func (Options) GetHelp

func (o Options) GetHelp() string

func (Options) GetOptionsCopy

func (o Options) GetOptionsCopy() OptionsList

func (*Options) Set

func (o *Options) Set(key string, value string)

type OptionsList

type OptionsList []*Option

func (OptionsList) Get

func (o OptionsList) Get(key string) (interface{}, bool, error)

type Parser

type Parser interface {
	Parse(*Options) (*feeds.Feed, error)
	GetOptions() Options
	String() string
}

Jump to

Keyboard shortcuts

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