parser

package
v0.44.6 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigurableParser added in v0.29.3

type ConfigurableParser interface {
	Parser
	Configure(config map[string]any) error
	Name() string
}

type Item

type Item struct {
	Site        string         `json:"site"`
	URL         string         `json:"url"` // original URL of the item
	Title       string         `json:"title"`
	Author      string         `json:"author"`
	Description string         `json:"description"`
	Tags        []string       `json:"tags"`
	Resources   []Resource     `json:"resources"`
	Extra       map[string]any `json:"extra"`
}

Item represents a parsed item with metadata and resources.

type Parser

type Parser interface {
	CanHandle(url string) bool
	Parse(ctx context.Context, url string) (*Item, error)
}

type Resource

type Resource struct {
	URL       string            `json:"url"`
	Filename  string            `json:"filename"` // with ext
	MimeType  string            `json:"mime_type"`
	Extension string            `json:"extension"` // e.g. "mp4"
	Size      int64             `json:"size"`      // 0 when unknown
	Hash      map[string]string `json:"hash"`      // {"md5": "...", "sha256": "..."}
	Headers   map[string]string `json:"headers"`   // HTTP headers when downloading
	Extra     map[string]any    `json:"extra"`
}

Resource is a single downloadable resource with metadata.

func (*Resource) FileName

func (r *Resource) FileName() string

func (*Resource) FileSize

func (r *Resource) FileSize() int64

func (*Resource) ID

func (r *Resource) ID() string

Jump to

Keyboard shortcuts

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