novel

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	// contains filtered or unexported fields
}

Novel data

func (*Novel) Fetch

func (i *Novel) Fetch() (err error)

Fetch additional data from pixiv single novel api (require login), only fetch once for same struct.

func (*Novel) FetchWithClient

func (i *Novel) FetchWithClient(c client.Client) (err error)

FetchWithClient do request with given client.

func (Novel) URL added in v0.3.0

func (i Novel) URL() *url.URL

URL to view web page.

func (Novel) URLWithClient added in v0.3.0

func (i Novel) URLWithClient(c client.Client) *url.URL

URLWithClient to view web page.

type SearchResult

type SearchResult struct {
	JSON gjson.Result
}

SearchResult holds search data and provide useful methods.

func Search(query string, page int) (result SearchResult, err error)

Search calls pixiv novel search api.

func SearchWithClient

func SearchWithClient(c client.Client, query string, page int) (result SearchResult, err error)

SearchWithClient do request with given client.

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 Series

type Series struct {
	ID    string
	Title string
}

Series data

func (Series) URL added in v0.3.0

func (i Series) URL() *url.URL

URL to view web page.

func (Series) URLWithClient added in v0.3.0

func (i Series) URLWithClient(c client.Client) *url.URL

URLWithClient to view web page.

Jump to

Keyboard shortcuts

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