artwork

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artwork

type Artwork struct {
	ID          string
	Title       string
	Type        string
	Description string
	Image       image.URLs
	Created     time.Time
	Tags        []string
	Author      user.User

	Width  int64
	Height int64

	PageCount     int64
	CommentCount  int64
	LikeCount     int64
	ViewCount     int64
	BookmarkCount int64

	Pages []Page
}

Artwork data

func (*Artwork) Fetch

func (i *Artwork) Fetch(ctx context.Context) (err error)

Fetch additional data from pixiv single artwork api,

func (*Artwork) FetchPages

func (i *Artwork) FetchPages(ctx context.Context) (err error)

FetchPages get all pages for artwork from pixiv artwork pages api,

func (Artwork) URL added in v0.3.0

func (i Artwork) URL(ctx context.Context) *url.URL

URL to view artwork web page.

type Page

type Page struct {
	Image  image.URLs
	Width  int64
	Height int64
}

Page is a artwork page.

type Rank

type Rank struct {
	/* required, possible rank modes:
		- daily (default)
	    - weekly
	    - monthly
	    - rookie
	    - original
	    - male
	    - female
	    - daily_r18
	    - weekly_r18
	    - male_r18
	    - female_r18
	    - r18g
	*/
	Mode string
	/* optional, possible rank content:
	    - all (default)
	    - illust
		- ugoira
		- manga
	*/
	Content string
	Date    time.Time
	Page    int
	Items   []RankItem
}

Rank contains data for one rank page.

func (*Rank) Fetch

func (rank *Rank) Fetch(ctx context.Context) (err error)

Fetch rank

func (Rank) URL added in v0.3.1

func (rank Rank) URL(ctx context.Context) *url.URL

URL to rank page.

func (Rank) URLWithQuery added in v0.4.0

func (rank Rank) URLWithQuery(ctx context.Context, q *url.Values) *url.URL

URLWithQuery to rank page.

type RankItem

type RankItem struct {
	Artwork
	Rank         int
	PreviousRank int
	JSON         gjson.Result
}

RankItem contains artwork and rank info.

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

type SearchResult struct {
	JSON gjson.Result
}

SearchResult holds search data and provide useful methods.

func Search(ctx context.Context, query string, opts ...SearchOption) (result SearchResult, err error)

Search calls pixiv artwork search api.

func (SearchResult) Artworks

func (r SearchResult) Artworks() []Artwork

Artworks appeared in search result.

func (SearchResult) ForEach

func (r SearchResult) ForEach(iterator func(key gjson.Result, value gjson.Result) bool)

ForEach iterates through values. skips advertisement container item.

Jump to

Keyboard shortcuts

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