webpage

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortInfo added in v0.8.1

func SortInfo(info []*Info)

SortInfo 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, error)

NewCache function creates Cache instance and import cache data.

func (*Cache) Get added in v0.6.0

func (c *Cache) Get(s string) *Info

Get method gets Web page data from cache.

func (*Cache) Put added in v0.6.0

func (c *Cache) Put(i *Info)

Put method puts Web page data to cache.

func (*Cache) PutURL added in v0.6.0

func (c *Cache) PutURL(ctx context.Context, urlStr string) (*Info, error)

PutURL reads Web page data from URL and puts to cache.

func (*Cache) Puts added in v0.8.0

func (c *Cache) Puts(is ...*Info)

Puts method puts list of Web page data to cache.

func (*Cache) Remove added in v0.6.0

func (c *Cache) Remove()

Remove method removes cache file.

func (*Cache) Save added in v0.6.0

func (c *Cache) Save() error

Save method saves data to cache file.

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, wp *Webpage) error

Parse method parses feeds.

type Info

type Info 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"`
}

func ReadPage

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

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

func (*Info) Encode added in v0.6.0

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

Encode putputs to io.Writer by JSON format.

func (*Info) ImageFile added in v0.6.0

func (i *Info) ImageFile(ctx context.Context, dir string) (string, error)

func (*Info) MakeMessage added in v0.7.0

func (info *Info) MakeMessage(prefixMsg string) string

type Webpage added in v0.8.0

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

Webpage is configuration for bookmark

func New added in v0.7.0

func New(cacheDir string, logger *log.ZapEventLogger) (*Webpage, error)

New functions creates new Config instance.

func (*Webpage) CreatePool added in v0.9.4

func (wp *Webpage) CreatePool()

CreatePool creates pool and starts goroutine,

func (*Webpage) Feed added in v0.8.0

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

Feed fetches feed URL and gets webpage informations.

func (*Webpage) FeedFlickr added in v0.8.0

func (wp *Webpage) FeedFlickr(ctx context.Context, flickrId string) error

Feed fetches feed URL and gets webpage informations.

func (*Webpage) GetErrorInPool added in v0.9.4

func (wp *Webpage) GetErrorInPool() error

func (*Webpage) GetInfoInPool added in v0.9.4

func (wp *Webpage) GetInfoInPool() []*Info

func (*Webpage) Logger added in v0.8.0

func (wp *Webpage) Logger() *zap.Logger

Logger method returns zap.Logger instance.

func (*Webpage) Lookup added in v0.8.0

func (wp *Webpage) Lookup(ctx context.Context, urlStr string, saveFlag bool) (*Info, error)

func (*Webpage) SaveCache added in v0.8.0

func (wp *Webpage) SaveCache() error

func (*Webpage) StopPool added in v0.9.4

func (wp *Webpage) StopPool()

StopPool creates pool and starts goroutine,

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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