Documentation ¶
Index ¶
- func HTMLContent(ctx context.Context, renderer ContentRenderer, content string) (ret string, err error)
- type ContentRenderer
- type Novel
- type SearchOption
- type SearchOptions
- type SearchResult
- type Series
- type SimpleContentRenderer
- func (r SimpleContentRenderer) Chapter(ctx context.Context, name string) (ret string, err error)
- func (r SimpleContentRenderer) Image(ctx context.Context, id string, index int) (ret string, err error)
- func (r SimpleContentRenderer) JumpPage(ctx context.Context, index int) (ret string, err error)
- func (r SimpleContentRenderer) JumpURI(ctx context.Context, title, uri string) (ret string, err error)
- func (r SimpleContentRenderer) NewPage(ctx context.Context, index int) (ret string, err error)
- func (r SimpleContentRenderer) Paragraph(ctx context.Context, text string) (ret string, err error)
- func (r SimpleContentRenderer) Ruby(ctx context.Context, ruby, rt string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTMLContent ¶ added in v0.4.1
func HTMLContent(ctx context.Context, renderer ContentRenderer, content string) (ret string, err error)
HTMLContent render novel content to html. format from https://www.pixiv.net/novel/upload.php
Types ¶
type ContentRenderer ¶ added in v0.4.1
type ContentRenderer interface { Image(ctx context.Context, id string, index int) (string, error) Paragraph(ctx context.Context, text string) (string, error) NewPage(ctx context.Context, index int) (string, error) Ruby(ctx context.Context, ruby, rt string) (string, error) Chapter(ctx context.Context, name string) (string, error) JumpURI(ctx context.Context, title, uri string) (string, error) JumpPage(ctx context.Context, page int) (string, error) }
ContentRenderer can render novel content
type Novel ¶
type Novel struct { ID string Title string Description string CoverURL string Content string Created time.Time Uploaded time.Time Author user.User Series Series Tags []string TextCount int64 PageCount int64 CommentCount int64 LikeCount int64 ViewCount int64 BookmarkCount int64 }
Novel data
func (Novel) HTMLContent ¶ added in v0.4.1
HTMLContent from content
type SearchOption ¶ added in v0.4.0
type SearchOption func(*SearchOptions)
SearchOption mutate SearchOptions
func SearchOptionPage ¶ added in v0.4.0
func SearchOptionPage(page int) SearchOption
SearchOptionPage change page to retrive
type SearchOptions ¶ added in v0.4.0
type SearchOptions struct {
Page int
}
SearchOptions for Search
type SearchResult ¶
SearchResult holds search data and provide useful methods.
func Search ¶
func Search(ctx context.Context, query string, opts ...SearchOption) (result SearchResult, err error)
Search calls pixiv novel search api.
func (SearchResult) ForEach ¶
func (r SearchResult) ForEach(iterator func(key, value gjson.Result) bool)
ForEach iterates through novel data items.
func (SearchResult) Novels ¶
func (r SearchResult) Novels() []Novel
Novels appeared in the search result.
type SimpleContentRenderer ¶ added in v0.4.1
type SimpleContentRenderer struct{}
SimpleContentRenderer is a simple implementation of ContentRenderer
func (SimpleContentRenderer) Image ¶ added in v0.4.1
func (r SimpleContentRenderer) Image(ctx context.Context, id string, index int) (ret string, err error)
Image implements ContentRenderer
func (SimpleContentRenderer) JumpURI ¶ added in v0.4.1
func (r SimpleContentRenderer) JumpURI(ctx context.Context, title, uri string) (ret string, err error)
JumpURI implements ContentRenderer
Click to show internal directories.
Click to hide internal directories.