webpage

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortPages added in v0.10.3

func SortPages(webpages []*Webpage)

SortPages function sorts Info list.

Types

type Cache added in v0.6.0

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

Cache is cache data for Web page informations.

func NewCache added in v0.6.0

func NewCache(dir string) *Cache

NewCache function creates Cache instance and import cache data.

func (*Cache) Get added in v0.6.0

func (c *Cache) Get(urlStr string) *Webpage

Get method gets Web page data from cache.

func (*Cache) Put added in v0.6.0

func (c *Cache) Put(page *Webpage)

Put method puts Web page data to cache.

type Config added in v0.10.0

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

Config is configuration for webpage

func New added in v0.7.0

func New(ctx context.Context, cacheDir string, logger *log.ZapEventLogger) (*Config, error)

New functions creates new Config instance.

func (*Config) CreatePool added in v0.10.0

func (cfg *Config) CreatePool()

CreatePool creates pool and starts goroutine,

func (*Config) Feed added in v0.10.0

func (cfg *Config) Feed(ctx context.Context, urlStr string) error

Feed fetches feed URL and gets webpage informations.

func (*Config) FeedFlickr added in v0.10.0

func (cfg *Config) FeedFlickr(ctx context.Context, flickrId string) error

Feed fetches feed URL and gets webpage informations.

func (*Config) GetErrorInPool added in v0.10.0

func (cfg *Config) GetErrorInPool() error

func (*Config) GetPagesFromPool added in v0.10.0

func (cfg *Config) GetPagesFromPool() []*Webpage

func (*Config) GetWebpage added in v0.10.0

func (cfg *Config) GetWebpage(ctx context.Context, urlStr string) (*Webpage, bool, error)

func (*Config) Logger added in v0.10.0

func (cfg *Config) Logger() *zap.Logger

Logger method returns zap.Logger instance.

func (*Config) Lookup added in v0.10.0

func (cfg *Config) Lookup(ctx context.Context, urlStr string) (*Webpage, error)

func (*Config) Save added in v0.10.0

func (cfg *Config) Save(ctx context.Context, list []*Webpage) error

func (*Config) StopPool added in v0.10.0

func (cfg *Config) StopPool() ([]*Webpage, error)

StopPool creates pool and starts goroutine,

type FeedList added in v0.9.0

type FeedList []string

FeedList is list of feed URLs.

func NewFeedList added in v0.9.0

func NewFeedList(path string) (FeedList, error)

NewFeedList function returns new instance of FeedList.

func (FeedList) Parse added in v0.9.0

func (fl FeedList) Parse(ctx context.Context, cfg *Config) error

Parse method parses feeds.

type Webpage added in v0.8.0

type Webpage struct {
	URL         string     `json:"url,omitempty"`
	Canonical   string     `json:"canonical,omitempty"`
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	ImageURL    string     `json:"image_url,omitempty"`
	Published   *time.Time `json:"published,omitempty"`
}

Webpage is information of web page

func ReadPage

func ReadPage(ctx context.Context, urlStr string) (*Webpage, error)

ReadPage function reads web page from URL, and analysis information.

func (*Webpage) Encode added in v0.10.0

func (i *Webpage) Encode(w io.Writer) error

Encode putputs to io.Writer by JSON format.

func (*Webpage) ImageFile added in v0.10.0

func (wp *Webpage) ImageFile(ctx context.Context, dir string) (string, error)

func (*Webpage) MakeMessage added in v0.10.0

func (wp *Webpage) MakeMessage(prefixMsg string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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