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.
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)
Click to show internal directories.
Click to hide internal directories.