html

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package html provides HTML content extraction for token savings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatResult

func FormatResult(result *ExtractResult) string

FormatResult formats extraction result for display.

Types

type ExtractResult

type ExtractResult struct {
	Title    string
	Content  string
	Author   string
	Date     string
	Summary  string
	Links    []string
	Images   []string
	SiteName string
}

ExtractResult contains extracted content.

type Extractor

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

Extractor extracts content from HTML.

func NewExtractor

func NewExtractor() *Extractor

NewExtractor creates a new HTML extractor.

func (*Extractor) Extract

func (e *Extractor) Extract(htmlContent string) (*ExtractResult, error)

Extract extracts content from HTML.

type GitHubExtractor

type GitHubExtractor struct{}

GitHubExtractor extracts content from GitHub.

func (*GitHubExtractor) Extract

func (g *GitHubExtractor) Extract(htmlContent string) (*ExtractResult, error)

type HackerNewsExtractor

type HackerNewsExtractor struct{}

HackerNewsExtractor extracts content from Hacker News.

func (*HackerNewsExtractor) Extract

func (h *HackerNewsExtractor) Extract(htmlContent string) (*ExtractResult, error)

type SiteExtractor

type SiteExtractor interface {
	Extract(htmlContent string) (*ExtractResult, error)
}

SiteExtractor extracts content from a specific site.

type SiteSpecificExtractors

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

SiteSpecificExtractors provide extractors for popular sites.

func NewSiteSpecificExtractors

func NewSiteSpecificExtractors() *SiteSpecificExtractors

NewSiteSpecificExtractors creates site-specific extractors.

func (*SiteSpecificExtractors) Extract

func (s *SiteSpecificExtractors) Extract(url, htmlContent string) (*ExtractResult, error)

Extract extracts content using site-specific extractor if available.

type StackOverflowExtractor

type StackOverflowExtractor struct{}

StackOverflowExtractor extracts from Stack Overflow.

func (*StackOverflowExtractor) Extract

func (s *StackOverflowExtractor) Extract(htmlContent string) (*ExtractResult, error)

type WikipediaExtractor

type WikipediaExtractor struct{}

WikipediaExtractor extracts from Wikipedia.

func (*WikipediaExtractor) Extract

func (w *WikipediaExtractor) Extract(htmlContent string) (*ExtractResult, error)

Jump to

Keyboard shortcuts

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