pixivapi

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: Zlib Imports: 12 Imported by: 1

README

Pixiv API

Yeah, it's a Pixiv API. Mainly based on pixivpy. It works, for the most part.

Possible TODOs
  • Document some of the fields. The restriction ones are probably bools, not sure about the others.
  • Some API calls to get a user return more fields than others. Maybe add those?

Documentation

Index

Constants

View Source
const (
	Client_ID     = "MOBrBDS8blbauoSck0ZfDbtuzpyT"
	Client_secret = "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj"
)
View Source
const (
	TAGS_PARTIAL      SearchTarget   = "partial_match_for_tags"
	TAGS_EXACT        SearchTarget   = "exact_match_for_tags"
	TITLE_AND_CAPTION SearchTarget   = "title_and_caption"
	DATE_DESC         SearchSort     = "date_desc"
	DATE_ASC          SearchSort     = "date_asc"
	WITHIN_DAY        SearchDuration = "within_last_day"
	WITHIN_WEEK       SearchDuration = "within_last_week"
	WITHIN_MONTH      SearchDuration = "within_last_month"
	WITHIN_NONE       SearchDuration = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BookmarkTagsResponse

type BookmarkTagsResponse struct {
	Bookmark_tags []struct {
		Name  string
		Count int
	}
	Offset int
}

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Followed added in v1.2.0

func (p *Client) Followed(visi Visibility) (*IllustrationListing, error)

func (*Client) GetIllust

func (p *Client) GetIllust(id int) (*Illustration, error)

func (*Client) GetMyId

func (p *Client) GetMyId() int

func (*Client) GetRequest

func (p *Client) GetRequest(url string) (*http.Response, error)

func (*Client) GetUser

func (p *Client) GetUser(id int) (*User, error)

func (*Client) IllustFromID

func (p *Client) IllustFromID(ID int) *Illustration

func (*Client) IsLoggedIn

func (p *Client) IsLoggedIn() bool

func (*Client) Login

func (p *Client) Login(token string) error

func (*Client) RankedIllust

func (p *Client) RankedIllust(mode RankingMode, day time.Time) (*IllustrationListing, error)

func (*Client) RecommendedIllust

func (p *Client) RecommendedIllust(kind IllustrationType) (*IllustrationListing, error)

func (*Client) RefreshToken

func (p *Client) RefreshToken() string

func (*Client) SearchIllust

func (p *Client) SearchIllust(term string, target SearchTarget, sorting SearchSort, duration SearchDuration) (*IllustrationListing, error)

func (*Client) SearchUser

func (p *Client) SearchUser(term string, sorting SearchSort, duration SearchDuration) (*UserListing, error)

func (*Client) SetToken

func (p *Client) SetToken(access, refresh string)

func (*Client) UserFromID

func (p *Client) UserFromID(ID int) *User

type Comment

type Comment struct {
	ID      int
	Comment string
	Date    time.Time
	User    *User
}

type Comments

type Comments struct {
	Total_comments int
	Offset         int
	Comments       []*Comment
}

type Illustration

type Illustration struct {
	ID         int
	Title      string
	Type       IllustrationType
	Image_urls multisize
	Caption    string
	// What does this mean? Is it an R18 bool?
	Restrict int
	User     *User
	Tags     []struct {
		Name, Translated_name string
	}
	Create_date time.Time
	Page_count  int
	Width       int
	Height      int
	// What do these mean?
	Sanity_level int
	X_restrict   int
	Series       struct {
		ID    int
		Title string
	}
	Meta_single_page struct {
		Original_image_url string
	}
	Meta_pages []struct {
		Image_urls multisize
	}
	Total_view      int
	Total_bookmarks int
	Is_bookmarked   bool
	Is_muted        bool
	Total_comments  int
	// contains filtered or unexported fields
}

func (*Illustration) Bookmark

func (i *Illustration) Bookmark(visi Visibility) error

func (*Illustration) Fetch

func (i *Illustration) Fetch() error

func (*Illustration) GetComments

func (i *Illustration) GetComments(offset int) (*Comments, error)

func (*Illustration) GetRelated

func (i *Illustration) GetRelated() (*IllustrationListing, error)

func (*Illustration) GetUgoiraMetadata

func (i *Illustration) GetUgoiraMetadata() (*UgoiraMetadata, error)

func (*Illustration) Unbookmark

func (i *Illustration) Unbookmark() error

type IllustrationListing

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

func (*IllustrationListing) Buffered

func (ls *IllustrationListing) Buffered() int

func (*IllustrationListing) HasNext

func (ls *IllustrationListing) HasNext() bool

func (*IllustrationListing) Next

func (ls *IllustrationListing) Next() (*Illustration, error)

func (*IllustrationListing) NextRequiresFetch

func (ls *IllustrationListing) NextRequiresFetch() bool

type IllustrationType

type IllustrationType string
const (
	ILTYPE_ILUST  IllustrationType = "illust"
	ILTYPE_UGOIRA IllustrationType = "ugoira"
	ILTYPE_MANGA  IllustrationType = "manga"
	// ILTYPE_NOVEL  IllustrationType = "novel"
	ILTYPE_NONE IllustrationType = ""
)

type RankingMode

type RankingMode string
const (
	DAY           RankingMode = "day"
	WEEK          RankingMode = "week"
	MONTH         RankingMode = "month"
	DAY_MALE      RankingMode = "day_male"
	DAY_FEMALE    RankingMode = "day_female"
	WEEK_ORIGINAL RankingMode = "week_original"
	WEEK_ROOKIE   RankingMode = "week_rookie"
)

type SearchDuration

type SearchDuration string

type SearchSort

type SearchSort string

type SearchTarget

type SearchTarget string

type UgoiraMetadata

type UgoiraMetadata struct {
	Zip_urls multisize
	Frames   []struct {
		File  string
		Delay int
	}
}

type User

type User struct {
	ID                 int
	Name               string
	Account            string
	Profile_image_urls multisize
	Is_followed        bool
	Comment            string
	// contains filtered or unexported fields
}

func (*User) BookmarkTags

func (u *User) BookmarkTags(visi Visibility, offset int) (*BookmarkTagsResponse, error)

func (*User) Bookmarks

func (u *User) Bookmarks(tag string, visibility Visibility) (*IllustrationListing, error)

func (*User) Fetch

func (u *User) Fetch() error

func (*User) Follow

func (u *User) Follow(visi Visibility) error

func (*User) Followers

func (u *User) Followers() (*UserListing, error)

This probably returns empty unless the user is us

func (*User) Following

func (u *User) Following(visi Visibility) (*UserListing, error)

func (*User) Illustrations

func (u *User) Illustrations(kind IllustrationType) (*IllustrationListing, error)

func (*User) Related

func (u *User) Related() (*UserListing, error)

func (*User) Unfollow

func (u *User) Unfollow() error

type UserListing

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

func (*UserListing) Buffered

func (ls *UserListing) Buffered() int

func (*UserListing) HasNext

func (ls *UserListing) HasNext() bool

func (*UserListing) Next

func (ls *UserListing) Next() (*User, error)

func (*UserListing) NextRequiresFetch

func (ls *UserListing) NextRequiresFetch() bool

type Visibility

type Visibility string
const VISI_PRIVATE Visibility = "private"
const VISI_PUBLIC Visibility = "public"

Jump to

Keyboard shortcuts

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