Documentation
¶
Overview ¶
Package pixivgo provides an unofficial Go client for the Pixiv App-API (6.x).
It supports illustration/novel/user queries, search, bookmarks, rankings, image downloads, and optional SNI bypass for restricted networks.
Basic usage:
client := pixivgo.NewClient()
resp, err := client.Auth(ctx, "your_refresh_token")
if err != nil {
log.Fatal(err)
}
result, err := client.SearchIllust(ctx, pixivgo.SearchIllustParams{
Word: "landscape",
})
Index ¶
- Variables
- func Bool(v bool) *bool
- func Int(v int) *int
- func ParseNextURL(nextURL *string) url.Values
- func String(v string) *string
- type AuthResponse
- type BookmarkDetail
- type BookmarkDetailResponse
- type BookmarkTag
- type Client
- func (c *Client) Auth(ctx context.Context, refreshToken string) (*AuthResponse, error)
- func (c *Client) Clone() *Client
- func (c *Client) Download(ctx context.Context, imageURL string, opts *DownloadOptions) (string, error)
- func (c *Client) DownloadToWriter(ctx context.Context, imageURL string, w io.Writer) error
- func (c *Client) IllustBookmarkAdd(ctx context.Context, params IllustBookmarkAddParams) error
- func (c *Client) IllustBookmarkDelete(ctx context.Context, params IllustBookmarkDeleteParams) error
- func (c *Client) IllustBookmarkDetail(ctx context.Context, params IllustBookmarkDetailParams) (*BookmarkDetailResponse, error)
- func (c *Client) IllustComments(ctx context.Context, params IllustCommentsParams) (*IllustCommentsResponse, error)
- func (c *Client) IllustDetail(ctx context.Context, params IllustDetailParams) (*IllustDetailResponse, error)
- func (c *Client) IllustFollow(ctx context.Context, params IllustFollowParams) (*IllustListResponse, error)
- func (c *Client) IllustNew(ctx context.Context, params IllustNewParams) (*IllustListResponse, error)
- func (c *Client) IllustRanking(ctx context.Context, params IllustRankingParams) (*IllustListResponse, error)
- func (c *Client) IllustRecommended(ctx context.Context, params IllustRecommendedParams) (*IllustListResponse, error)
- func (c *Client) IllustRelated(ctx context.Context, params IllustRelatedParams) (*IllustListResponse, error)
- func (c *Client) NovelComments(ctx context.Context, params NovelCommentsParams) (*NovelComments, error)
- func (c *Client) NovelDetail(ctx context.Context, params NovelDetailParams) (*NovelInfo, error)
- func (c *Client) NovelFollow(ctx context.Context, params NovelFollowParams) (*NovelListResponse, error)
- func (c *Client) NovelNew(ctx context.Context, params NovelNewParams) (*NovelListResponse, error)
- func (c *Client) NovelRecommended(ctx context.Context, params NovelRecommendedParams) (*NovelListResponse, error)
- func (c *Client) NovelSeries(ctx context.Context, params NovelSeriesParams) (*NovelSeriesResponse, error)
- func (c *Client) SearchIllust(ctx context.Context, params SearchIllustParams) (*SearchIllustrations, error)
- func (c *Client) SearchNovel(ctx context.Context, params SearchNovelParams) (*SearchNovelResponse, error)
- func (c *Client) SearchUser(ctx context.Context, params SearchUserParams) (*UserListResponse, error)
- func (c *Client) SetAPIProxy(proxyHosts string)
- func (c *Client) SetAcceptLanguage(lang string)
- func (c *Client) SetAdditionalHeaders(h http.Header)
- func (c *Client) SetAuth(accessToken string, refreshToken string)
- func (c *Client) ShowcaseArticle(ctx context.Context, params ShowcaseArticleParams) (*ShowcaseArticleResponse, error)
- func (c *Client) TrendingTagsIllust(ctx context.Context, params TrendingTagsIllustParams) (*TrendingTagsResponse, error)
- func (c *Client) UgoiraMetadata(ctx context.Context, params UgoiraMetadataParams) (*UgoiraMetadataResponse, error)
- func (c *Client) UserBookmarkTagsIllust(ctx context.Context, params UserBookmarkTagsIllustParams) (*UserBookmarkTagsResponse, error)
- func (c *Client) UserBookmarksIllust(ctx context.Context, params UserBookmarksIllustParams) (*UserBookmarksIllustrations, error)
- func (c *Client) UserBookmarksNovel(ctx context.Context, params UserBookmarksNovelParams) (*UserBookmarksNovel, error)
- func (c *Client) UserDetail(ctx context.Context, params UserDetailParams) (*UserInfoDetailed, error)
- func (c *Client) UserEditAIShowSettings(ctx context.Context, params UserEditAIShowSettingsParams) error
- func (c *Client) UserFollowAdd(ctx context.Context, params UserFollowAddParams) error
- func (c *Client) UserFollowDelete(ctx context.Context, params UserFollowDeleteParams) error
- func (c *Client) UserFollower(ctx context.Context, params UserFollowerParams) (*UserListResponse, error)
- func (c *Client) UserFollowing(ctx context.Context, params UserFollowingParams) (*UserFollowing, error)
- func (c *Client) UserID() string
- func (c *Client) UserIllusts(ctx context.Context, params UserIllustsParams) (*UserIllustrations, error)
- func (c *Client) UserList(ctx context.Context, params UserListParams) (*UserListResponse, error)
- func (c *Client) UserMyPixiv(ctx context.Context, params UserMyPixivParams) (*UserListResponse, error)
- func (c *Client) UserNovels(ctx context.Context, params UserNovelsParams) (*UserNovels, error)
- func (c *Client) UserRecommended(ctx context.Context, params UserRecommendedParams) (*UserListResponse, error)
- func (c *Client) UserRelated(ctx context.Context, params UserRelatedParams) (*UserListResponse, error)
- func (c *Client) WebviewNovel(ctx context.Context, params WebviewNovelParams) (*WebviewNovelResult, error)
- type Comment
- type CommentUser
- type DownloadOptions
- type Duration
- type Filter
- type FlexInt
- type IllustBookmarkAddParams
- type IllustBookmarkDeleteParams
- type IllustBookmarkDetailParams
- type IllustCommentsParams
- type IllustCommentsResponse
- type IllustDetailParams
- type IllustDetailResponse
- type IllustFollowParams
- type IllustListResponse
- type IllustNewParams
- type IllustRankingParams
- type IllustRecommendedParams
- type IllustRelatedParams
- type IllustType
- type IllustrationInfo
- type IllustrationTag
- type ImageUrls
- type MetaPage
- type MetaSinglePage
- type NovelComments
- type NovelCommentsParams
- type NovelDetailParams
- type NovelDetailResponse
- type NovelFollowParams
- type NovelInfo
- type NovelListResponse
- type NovelNavigationInfo
- type NovelNewParams
- type NovelRating
- type NovelRecommendedParams
- type NovelSeriesParams
- type NovelSeriesResponse
- type NovelTag
- type Option
- type PixivError
- type Profile
- type ProfileImageUrls
- type ProfilePublicity
- type RankingMode
- type Restrict
- type SearchIllustParams
- type SearchIllustrations
- type SearchNovelParams
- type SearchNovelResponse
- type SearchTarget
- type SearchUserParams
- type Series
- type ShowcaseArticleParams
- type ShowcaseArticleResponse
- type Sort
- type TrendTag
- type TrendingTagsIllustParams
- type TrendingTagsResponse
- type UgoiraFrame
- type UgoiraMetadata
- type UgoiraMetadataParams
- type UgoiraMetadataResponse
- type UgoiraZipUrls
- type UserBookmarkTag
- type UserBookmarkTagsIllustParams
- type UserBookmarkTagsResponse
- type UserBookmarksIllustParams
- type UserBookmarksIllustrations
- type UserBookmarksNovel
- type UserBookmarksNovelParams
- type UserDetailParams
- type UserEditAIShowSettingsParams
- type UserFollowAddParams
- type UserFollowDeleteParams
- type UserFollowerParams
- type UserFollowing
- type UserFollowingParams
- type UserIllustrations
- type UserIllustsParams
- type UserInfo
- type UserInfoDetailed
- type UserListParams
- type UserListResponse
- type UserMyPixivParams
- type UserNovels
- type UserNovelsParams
- type UserPreview
- type UserRecommendedParams
- type UserRelatedParams
- type WebviewNovel
- type WebviewNovelParams
- type WebviewNovelResult
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var ErrAuthRequired = errors.New("pixivgo: authentication required; call Auth() or SetAuth() first")
ErrAuthRequired is returned when an API method requires authentication but no access token has been set.
Functions ¶
func Int ¶
Int returns a pointer to the given int value. Useful for setting optional *int fields in parameter structs.
func ParseNextURL ¶
ParseNextURL extracts query parameters from a Pixiv next_url pagination string. It handles PHP-style array parameters (e.g., "seed_illust_ids[]" → "seed_illust_ids"). Returns nil if nextURL is nil or empty.
Types ¶
type AuthResponse ¶
type AuthResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
RefreshToken string `json:"refresh_token"`
User UserInfo `json:"user"`
}
AuthResponse contains the token data from an auth request.
type BookmarkDetail ¶
type BookmarkDetail struct {
IsBookmarked bool `json:"is_bookmarked"`
Tags []BookmarkTag `json:"tags"`
Restrict string `json:"restrict"`
}
BookmarkDetail contains bookmark information.
type BookmarkDetailResponse ¶
type BookmarkDetailResponse struct {
BookmarkDetail BookmarkDetail `json:"bookmark_detail"`
}
BookmarkDetailResponse is the response from illust_bookmark_detail.
type BookmarkTag ¶
BookmarkTag contains a bookmark tag with registration status.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Pixiv App-API client. It is safe for concurrent use after construction.
func (*Client) Auth ¶
Auth authenticates with Pixiv using a refresh token. It stores the resulting access token and refresh token on the client. Password authentication is not supported (deprecated by Pixiv).
func (*Client) Clone ¶
Clone returns a copy that shares the underlying *http.Client (transport and connection pool) but holds an independent auth token: SetAuth or Auth on one never affects the other. Use it to pin a token for the duration of a request — e.g. a refresh-and-retry that must not race a concurrent SetAuth.
func (*Client) Download ¶
func (c *Client) Download(ctx context.Context, imageURL string, opts *DownloadOptions) (string, error)
Download downloads an image from the given URL to a file. Returns the path of the saved file.
func (*Client) DownloadToWriter ¶
DownloadToWriter downloads an image from the given URL and writes it to w.
func (*Client) IllustBookmarkAdd ¶
func (c *Client) IllustBookmarkAdd(ctx context.Context, params IllustBookmarkAddParams) error
IllustBookmarkAdd adds an illustration to bookmarks. Requires authentication.
func (*Client) IllustBookmarkDelete ¶
func (c *Client) IllustBookmarkDelete(ctx context.Context, params IllustBookmarkDeleteParams) error
IllustBookmarkDelete removes an illustration from bookmarks. Requires authentication.
func (*Client) IllustBookmarkDetail ¶
func (c *Client) IllustBookmarkDetail(ctx context.Context, params IllustBookmarkDetailParams) (*BookmarkDetailResponse, error)
IllustBookmarkDetail returns bookmark detail for an illustration.
func (*Client) IllustComments ¶
func (c *Client) IllustComments(ctx context.Context, params IllustCommentsParams) (*IllustCommentsResponse, error)
IllustComments returns comments on an illustration.
func (*Client) IllustDetail ¶
func (c *Client) IllustDetail(ctx context.Context, params IllustDetailParams) (*IllustDetailResponse, error)
IllustDetail returns detail information for an illustration.
func (*Client) IllustFollow ¶
func (c *Client) IllustFollow(ctx context.Context, params IllustFollowParams) (*IllustListResponse, error)
IllustFollow returns new illustrations from followed users. Requires authentication.
func (*Client) IllustNew ¶
func (c *Client) IllustNew(ctx context.Context, params IllustNewParams) (*IllustListResponse, error)
IllustNew returns the latest illustrations.
func (*Client) IllustRanking ¶
func (c *Client) IllustRanking(ctx context.Context, params IllustRankingParams) (*IllustListResponse, error)
IllustRanking returns illustration rankings.
func (*Client) IllustRecommended ¶
func (c *Client) IllustRecommended(ctx context.Context, params IllustRecommendedParams) (*IllustListResponse, error)
IllustRecommended returns recommended illustrations. When NoAuth is true, the no-login endpoint is used.
func (*Client) IllustRelated ¶
func (c *Client) IllustRelated(ctx context.Context, params IllustRelatedParams) (*IllustListResponse, error)
IllustRelated returns illustrations related to the specified illustration.
func (*Client) NovelComments ¶
func (c *Client) NovelComments(ctx context.Context, params NovelCommentsParams) (*NovelComments, error)
NovelComments returns comments on a novel.
func (*Client) NovelDetail ¶
NovelDetail returns detail information for a novel.
func (*Client) NovelFollow ¶
func (c *Client) NovelFollow(ctx context.Context, params NovelFollowParams) (*NovelListResponse, error)
NovelFollow returns new novels from followed users. Requires authentication.
func (*Client) NovelNew ¶
func (c *Client) NovelNew(ctx context.Context, params NovelNewParams) (*NovelListResponse, error)
NovelNew returns the latest novels.
func (*Client) NovelRecommended ¶
func (c *Client) NovelRecommended(ctx context.Context, params NovelRecommendedParams) (*NovelListResponse, error)
NovelRecommended returns recommended novels.
func (*Client) NovelSeries ¶
func (c *Client) NovelSeries(ctx context.Context, params NovelSeriesParams) (*NovelSeriesResponse, error)
NovelSeries returns detail for a novel series.
func (*Client) SearchIllust ¶
func (c *Client) SearchIllust(ctx context.Context, params SearchIllustParams) (*SearchIllustrations, error)
SearchIllust searches for illustrations by keyword.
func (*Client) SearchNovel ¶
func (c *Client) SearchNovel(ctx context.Context, params SearchNovelParams) (*SearchNovelResponse, error)
SearchNovel searches for novels by keyword.
func (*Client) SearchUser ¶
func (c *Client) SearchUser(ctx context.Context, params SearchUserParams) (*UserListResponse, error)
SearchUser searches for users by keyword.
func (*Client) SetAPIProxy ¶
SetAPIProxy changes the API base URL (e.g., "http://app-api.pixivlite.com").
func (*Client) SetAcceptLanguage ¶
SetAcceptLanguage sets the Accept-Language header for tag translations.
func (*Client) SetAdditionalHeaders ¶
SetAdditionalHeaders overrides the additional headers for all requests.
func (*Client) SetAuth ¶
SetAuth manually sets the access token and optionally the refresh token. Use this when you already have valid tokens.
func (*Client) ShowcaseArticle ¶
func (c *Client) ShowcaseArticle(ctx context.Context, params ShowcaseArticleParams) (*ShowcaseArticleResponse, error)
ShowcaseArticle returns a featured showcase article. This uses the Pixiv Web API (no authentication required).
func (*Client) TrendingTagsIllust ¶
func (c *Client) TrendingTagsIllust(ctx context.Context, params TrendingTagsIllustParams) (*TrendingTagsResponse, error)
TrendingTagsIllust returns trending tags for illustrations.
func (*Client) UgoiraMetadata ¶
func (c *Client) UgoiraMetadata(ctx context.Context, params UgoiraMetadataParams) (*UgoiraMetadataResponse, error)
UgoiraMetadata returns metadata for an animated illustration (ugoira).
func (*Client) UserBookmarkTagsIllust ¶
func (c *Client) UserBookmarkTagsIllust(ctx context.Context, params UserBookmarkTagsIllustParams) (*UserBookmarkTagsResponse, error)
UserBookmarkTagsIllust returns a user's bookmark tags for illustrations.
func (*Client) UserBookmarksIllust ¶
func (c *Client) UserBookmarksIllust(ctx context.Context, params UserBookmarksIllustParams) (*UserBookmarksIllustrations, error)
UserBookmarksIllust returns a user's bookmarked illustrations.
func (*Client) UserBookmarksNovel ¶
func (c *Client) UserBookmarksNovel(ctx context.Context, params UserBookmarksNovelParams) (*UserBookmarksNovel, error)
UserBookmarksNovel returns a user's bookmarked novels.
func (*Client) UserDetail ¶
func (c *Client) UserDetail(ctx context.Context, params UserDetailParams) (*UserInfoDetailed, error)
UserDetail returns detailed information for a user.
func (*Client) UserEditAIShowSettings ¶
func (c *Client) UserEditAIShowSettings(ctx context.Context, params UserEditAIShowSettingsParams) error
UserEditAIShowSettings toggles the visibility of AI-generated works. Requires authentication.
func (*Client) UserFollowAdd ¶
func (c *Client) UserFollowAdd(ctx context.Context, params UserFollowAddParams) error
UserFollowAdd follows a user. Requires authentication.
func (*Client) UserFollowDelete ¶
func (c *Client) UserFollowDelete(ctx context.Context, params UserFollowDeleteParams) error
UserFollowDelete unfollows a user. Requires authentication.
func (*Client) UserFollower ¶
func (c *Client) UserFollower(ctx context.Context, params UserFollowerParams) (*UserListResponse, error)
UserFollower returns a user's followers.
func (*Client) UserFollowing ¶
func (c *Client) UserFollowing(ctx context.Context, params UserFollowingParams) (*UserFollowing, error)
UserFollowing returns the users that a user is following.
func (*Client) UserIllusts ¶
func (c *Client) UserIllusts(ctx context.Context, params UserIllustsParams) (*UserIllustrations, error)
UserIllusts returns a user's illustrations.
func (*Client) UserList ¶
func (c *Client) UserList(ctx context.Context, params UserListParams) (*UserListResponse, error)
UserList returns a user's blacklist.
func (*Client) UserMyPixiv ¶
func (c *Client) UserMyPixiv(ctx context.Context, params UserMyPixivParams) (*UserListResponse, error)
UserMyPixiv returns a user's "My Pixiv" (close friends).
func (*Client) UserNovels ¶
func (c *Client) UserNovels(ctx context.Context, params UserNovelsParams) (*UserNovels, error)
UserNovels returns a user's novels.
func (*Client) UserRecommended ¶
func (c *Client) UserRecommended(ctx context.Context, params UserRecommendedParams) (*UserListResponse, error)
UserRecommended returns recommended users.
func (*Client) UserRelated ¶
func (c *Client) UserRelated(ctx context.Context, params UserRelatedParams) (*UserListResponse, error)
UserRelated returns users related to the specified user.
func (*Client) WebviewNovel ¶
func (c *Client) WebviewNovel(ctx context.Context, params WebviewNovelParams) (*WebviewNovelResult, error)
WebviewNovel fetches novel content from the webview endpoint. If params.Raw is true, RawHTML is populated. Otherwise, Novel is populated by extracting and parsing JSON from the HTML.
type Comment ¶
type Comment struct {
ID FlexInt `json:"id"`
Comment string `json:"comment"`
Date string `json:"date"`
User *CommentUser `json:"user"`
ParentComment *Comment `json:"parent_comment,omitempty"`
}
Comment represents a comment on an illustration or novel.
type CommentUser ¶
type CommentUser struct {
ID FlexInt `json:"id"`
Name string `json:"name"`
Account string `json:"account"`
ProfileImageUrls ProfileImageUrls `json:"profile_image_urls"`
}
CommentUser contains user info as it appears in comments.
type DownloadOptions ¶
type DownloadOptions struct {
Path string // directory to save to (default: current directory)
Name string // filename override (default: basename from URL)
Prefix string // filename prefix
Replace bool // overwrite existing files (default: false)
Referer string // Referer header (default: "https://app-api.pixiv.net/")
}
DownloadOptions controls how images are downloaded.
type FlexInt ¶
type FlexInt int
FlexInt is an int that can be unmarshaled from both JSON numbers and strings. Pixiv's API is inconsistent: the auth endpoint returns user IDs as strings, while other endpoints return them as integers.
func (FlexInt) MarshalJSON ¶
func (*FlexInt) UnmarshalJSON ¶
type IllustBookmarkAddParams ¶
IllustBookmarkAddParams are the parameters for IllustBookmarkAdd.
type IllustBookmarkDeleteParams ¶
IllustBookmarkDeleteParams are the parameters for IllustBookmarkDelete.
type IllustBookmarkDetailParams ¶
IllustBookmarkDetailParams are the parameters for IllustBookmarkDetail.
type IllustCommentsParams ¶
type IllustCommentsParams struct {
IllustID int
Offset *int
IncludeTotalComments *bool
NoAuth bool
}
IllustCommentsParams are the parameters for IllustComments.
type IllustCommentsResponse ¶
type IllustCommentsResponse struct {
TotalComments int `json:"total_comments"`
Comments []Comment `json:"comments"`
NextURL *string `json:"next_url"`
CommentAccessControl int `json:"comment_access_control"`
}
IllustCommentsResponse is the response from illust_comments.
type IllustDetailParams ¶
IllustDetailParams are the parameters for IllustDetail.
type IllustDetailResponse ¶
type IllustDetailResponse struct {
Illust IllustrationInfo `json:"illust"`
}
IllustDetailResponse is the response from illust_detail.
type IllustFollowParams ¶
IllustFollowParams are the parameters for IllustFollow.
type IllustListResponse ¶
type IllustListResponse struct {
Illusts []IllustrationInfo `json:"illusts"`
NextURL *string `json:"next_url"`
}
IllustListResponse is a generic response containing a list of illustrations. Used by illust_related, illust_recommended, illust_ranking, illust_follow, illust_new.
type IllustNewParams ¶
type IllustNewParams struct {
ContentType IllustType
Filter Filter
MaxIllustID *int
NoAuth bool
}
IllustNewParams are the parameters for IllustNew.
type IllustRankingParams ¶
type IllustRankingParams struct {
Mode RankingMode
Filter Filter
Date *string // "YYYY-MM-DD"
Offset *int
NoAuth bool
}
IllustRankingParams are the parameters for IllustRanking.
type IllustRecommendedParams ¶
type IllustRecommendedParams struct {
ContentType IllustType
IncludeRankingLabel *bool
Filter Filter
MaxBookmarkIDForRecommend *int
MinBookmarkIDForRecentIllust *int
Offset *int
IncludeRankingIllusts *bool
BookmarkIllustIDs []string
IncludePrivacyPolicy *string
Viewed []string
NoAuth bool
}
IllustRecommendedParams are the parameters for IllustRecommended.
type IllustRelatedParams ¶
type IllustRelatedParams struct {
IllustID int
Filter Filter
SeedIllustIDs []string
Offset *int
Viewed []string
NoAuth bool
}
IllustRelatedParams are the parameters for IllustRelated.
type IllustType ¶
type IllustType string
IllustType is the type of illustration.
const ( IllustTypeIllust IllustType = "illust" IllustTypeManga IllustType = "manga" )
type IllustrationInfo ¶
type IllustrationInfo struct {
ID FlexInt `json:"id"`
Title string `json:"title"`
Type string `json:"type"`
ImageUrls ImageUrls `json:"image_urls"`
Caption string `json:"caption"`
Restrict int `json:"restrict"`
User UserInfo `json:"user"`
Tags []IllustrationTag `json:"tags"`
Tools []string `json:"tools"`
CreateDate string `json:"create_date"`
PageCount int `json:"page_count"`
Width int `json:"width"`
Height int `json:"height"`
SanityLevel int `json:"sanity_level"`
XRestrict int `json:"x_restrict"`
Series *Series `json:"series"`
MetaSinglePage MetaSinglePage `json:"meta_single_page"`
MetaPages []MetaPage `json:"meta_pages"`
TotalView int `json:"total_view"`
TotalBookmarks int `json:"total_bookmarks"`
IsBookmarked bool `json:"is_bookmarked"`
Visible bool `json:"visible"`
IsMuted bool `json:"is_muted"`
IllustAIType int `json:"illust_ai_type"`
IllustBookStyle int `json:"illust_book_style"`
TotalComments *int `json:"total_comments,omitempty"`
RestrictionAttributes []string `json:"restriction_attributes"`
}
IllustrationInfo contains complete illustration details.
type IllustrationTag ¶
type IllustrationTag struct {
Name string `json:"name"`
TranslatedName *string `json:"translated_name"`
}
IllustrationTag is a tag on an illustration.
type ImageUrls ¶
type ImageUrls struct {
SquareMedium string `json:"square_medium"`
Medium string `json:"medium"`
Large string `json:"large"`
Original *string `json:"original,omitempty"`
}
ImageUrls contains illustration image URLs at various sizes.
Original is only present on per-page image_urls (meta_pages entries); the top-level illust image_urls omits it (single-page works expose the original via MetaSinglePage.OriginalImageURL instead). Hence the pointer + omitempty.
type MetaPage ¶
type MetaPage struct {
ImageUrls ImageUrls `json:"image_urls"`
}
MetaPage contains image URLs for multi-page illustrations.
type MetaSinglePage ¶
type MetaSinglePage struct {
OriginalImageURL *string `json:"original_image_url,omitempty"`
}
MetaSinglePage contains the original image URL for single-page illustrations.
type NovelComments ¶
type NovelComments struct {
TotalComments int `json:"total_comments"`
Comments []Comment `json:"comments"`
NextURL *string `json:"next_url"`
CommentAccessControl int `json:"comment_access_control"`
}
NovelComments is the response from novel_comments.
type NovelCommentsParams ¶
NovelCommentsParams are the parameters for NovelComments.
type NovelDetailParams ¶
NovelDetailParams are the parameters for NovelDetail.
type NovelDetailResponse ¶
type NovelDetailResponse struct {
Novel NovelInfo `json:"novel"`
}
NovelDetailResponse wraps the novel_detail endpoint response.
type NovelFollowParams ¶
NovelFollowParams are the parameters for NovelFollow.
type NovelInfo ¶
type NovelInfo struct {
ID FlexInt `json:"id"`
Title string `json:"title"`
Caption string `json:"caption"`
Restrict int `json:"restrict"`
XRestrict int `json:"x_restrict"`
IsOriginal bool `json:"is_original"`
ImageUrls ImageUrls `json:"image_urls"`
CreateDate string `json:"create_date"`
Tags []NovelTag `json:"tags"`
PageCount int `json:"page_count"`
TextLength int `json:"text_length"`
User UserInfo `json:"user"`
Series *Series `json:"series"`
IsBookmarked bool `json:"is_bookmarked"`
TotalBookmarks int `json:"total_bookmarks"`
TotalView int `json:"total_view"`
Visible bool `json:"visible"`
TotalComments int `json:"total_comments"`
IsMuted bool `json:"is_muted"`
IsMyPixivOnly bool `json:"is_mypixiv_only"`
IsXRestricted bool `json:"is_x_restricted"`
NovelAIType int `json:"novel_ai_type"`
CommentAccessControl *int `json:"comment_access_control,omitempty"`
}
NovelInfo contains complete novel details.
type NovelListResponse ¶
type NovelListResponse struct {
Novels []NovelInfo `json:"novels"`
NextURL *string `json:"next_url"`
}
NovelListResponse is a generic response containing a list of novels. Used by novel_recommended, novel_new, novel_follow.
type NovelNavigationInfo ¶
type NovelNavigationInfo struct {
}
NovelNavigationInfo contains navigation info within a novel series.
type NovelNewParams ¶
NovelNewParams are the parameters for NovelNew.
type NovelRating ¶
type NovelRating struct {
Like int `json:"like"`
Bookmark int `json:"bookmark"`
View int `json:"view"`
}
NovelRating contains like/bookmark/view counts for a novel.
type NovelRecommendedParams ¶
type NovelRecommendedParams struct {
IncludeRankingLabel *bool
Filter Filter
Offset *int
IncludeRankingNovels *bool
AlreadyRecommended []string
MaxBookmarkIDForRecommend *int
IncludePrivacyPolicy *string
NoAuth bool
}
NovelRecommendedParams are the parameters for NovelRecommended.
type NovelSeriesParams ¶
NovelSeriesParams are the parameters for NovelSeries.
type NovelSeriesResponse ¶
type NovelSeriesResponse struct {
NovelSeriesDetail any `json:"novel_series_detail"`
Novels []NovelInfo `json:"novels"`
NextURL *string `json:"next_url"`
}
NovelSeriesResponse is the response from novel_series.
type NovelTag ¶
type NovelTag struct {
Name string `json:"name"`
TranslatedName *string `json:"translated_name"`
AddedByUploadedUser bool `json:"added_by_uploaded_user"`
}
NovelTag is a tag on a novel.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithAcceptLanguage ¶
WithAcceptLanguage sets the Accept-Language header for tag translations. Common values: "en-us", "zh-cn", "ja".
func WithAdditionalHeaders ¶
WithAdditionalHeaders sets additional HTTP headers for all requests.
func WithBaseURL ¶
WithBaseURL overrides the default API base URL (https://app-api.pixiv.net).
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client for all requests. Use this to inject proxied clients or bypass-configured transports.
type PixivError ¶
PixivError represents an error from the Pixiv API or the HTTP transport layer.
func (*PixivError) Error ¶
func (e *PixivError) Error() string
func (*PixivError) Unwrap ¶
func (e *PixivError) Unwrap() error
type Profile ¶
type Profile struct {
Webpage *string `json:"webpage"`
Gender string `json:"gender"`
Birth string `json:"birth"`
BirthDay string `json:"birth_day"`
BirthYear int `json:"birth_year"`
Region string `json:"region"`
AddressID int `json:"address_id"`
CountryCode string `json:"country_code"`
Job string `json:"job"`
JobID int `json:"job_id"`
TotalFollowUsers int `json:"total_follow_users"`
TotalMyPixivUsers int `json:"total_mypixiv_users"`
TotalIllusts int `json:"total_illusts"`
TotalManga int `json:"total_manga"`
TotalNovels int `json:"total_novels"`
TotalIllustBookmarksPublic int `json:"total_illust_bookmarks_public"`
TotalIllustSeries int `json:"total_illust_series"`
TotalNovelSeries int `json:"total_novel_series"`
BackgroundImageURL string `json:"background_image_url"`
TwitterAccount string `json:"twitter_account"`
TwitterURL *string `json:"twitter_url"`
PawooURL *string `json:"pawoo_url"`
IsPremium bool `json:"is_premium"`
IsUsingCustomProfileImage bool `json:"is_using_custom_profile_image"`
}
Profile contains extended user profile details.
type ProfileImageUrls ¶
type ProfileImageUrls struct {
Medium string `json:"medium"`
}
ProfileImageUrls contains user profile image URLs.
type ProfilePublicity ¶
type ProfilePublicity struct {
Gender string `json:"gender"`
Region string `json:"region"`
BirthDay string `json:"birth_day"`
BirthYear string `json:"birth_year"`
Job string `json:"job"`
Pawoo bool `json:"pawoo"`
}
ProfilePublicity contains privacy settings.
type RankingMode ¶
type RankingMode string
RankingMode is the ranking period/category.
const ( ModeDay RankingMode = "day" ModeWeek RankingMode = "week" ModeMonth RankingMode = "month" ModeDayMale RankingMode = "day_male" ModeDayFemale RankingMode = "day_female" ModeWeekOriginal RankingMode = "week_original" ModeWeekRookie RankingMode = "week_rookie" ModeDayManga RankingMode = "day_manga" ModeDayR18 RankingMode = "day_r18" ModeDayMaleR18 RankingMode = "day_male_r18" ModeDayFemaleR18 RankingMode = "day_female_r18" ModeWeekR18 RankingMode = "week_r18" ModeWeekR18G RankingMode = "week_r18g" )
type SearchIllustParams ¶
type SearchIllustParams struct {
Word string // required
SearchTarget SearchTarget // default: PartialMatchForTags
Sort Sort // default: SortDateDesc
Duration *Duration
StartDate *string // "YYYY-MM-DD"
EndDate *string // "YYYY-MM-DD"
Filter Filter
SearchAIType *int // 0 or 1
Offset *int
NoAuth bool
}
SearchIllustParams are the parameters for SearchIllust.
type SearchIllustrations ¶
type SearchIllustrations struct {
Illusts []IllustrationInfo `json:"illusts"`
NextURL *string `json:"next_url"`
SearchSpanLimit int `json:"search_span_limit"`
ShowAI bool `json:"show_ai"`
}
SearchIllustrations is the response from search_illust.
type SearchNovelParams ¶
type SearchNovelParams struct {
Word string
SearchTarget SearchTarget
Sort Sort
MergePlainKeywordResults *string // "true" or "false"
IncludeTranslatedTagResults *string // "true" or "false"
StartDate *string
EndDate *string
Filter *string
SearchAIType *int
Offset *int
NoAuth bool
}
SearchNovelParams are the parameters for SearchNovel.
type SearchNovelResponse ¶
type SearchNovelResponse struct {
Novels []NovelInfo `json:"novels"`
NextURL *string `json:"next_url"`
SearchSpanLimit int `json:"search_span_limit"`
ShowAI bool `json:"show_ai"`
}
SearchNovelResponse is the response from search_novel.
type SearchTarget ¶
type SearchTarget string
SearchTarget controls how search queries are matched.
const ( PartialMatchForTags SearchTarget = "partial_match_for_tags" ExactMatchForTags SearchTarget = "exact_match_for_tags" TitleAndCaption SearchTarget = "title_and_caption" Keyword SearchTarget = "keyword" )
type SearchUserParams ¶
type SearchUserParams struct {
Word string
Sort Sort
Duration *Duration
Filter Filter
Offset *int
NoAuth bool
}
SearchUserParams are the parameters for SearchUser.
type Series ¶
Series contains series information. Pixiv returns {} instead of null for empty series; in that case ID will be 0.
type ShowcaseArticleParams ¶
type ShowcaseArticleParams struct {
ShowcaseID int
}
ShowcaseArticleParams are the parameters for ShowcaseArticle.
type ShowcaseArticleResponse ¶
type ShowcaseArticleResponse struct {
Body any `json:"body"`
}
ShowcaseArticleResponse is the response from showcase_article.
type TrendTag ¶
type TrendTag struct {
Tag IllustrationTag `json:"tag"`
TranslatedName *string `json:"translated_name"`
Illust IllustrationInfo `json:"illust"`
}
TrendTag is a trending tag with a sample illustration.
type TrendingTagsIllustParams ¶
TrendingTagsIllustParams are the parameters for TrendingTagsIllust.
type TrendingTagsResponse ¶
type TrendingTagsResponse struct {
TrendTags []TrendTag `json:"trend_tags"`
}
TrendingTagsResponse is the response from trending_tags_illust.
type UgoiraFrame ¶
UgoiraFrame contains timing information for a single ugoira frame.
type UgoiraMetadata ¶
type UgoiraMetadata struct {
ZipUrls UgoiraZipUrls `json:"zip_urls"`
Frames []UgoiraFrame `json:"frames"`
}
UgoiraMetadata contains animated illustration metadata.
type UgoiraMetadataParams ¶
UgoiraMetadataParams are the parameters for UgoiraMetadata.
type UgoiraMetadataResponse ¶
type UgoiraMetadataResponse struct {
UgoiraMetadata UgoiraMetadata `json:"ugoira_metadata"`
}
UgoiraMetadataResponse is the response from ugoira_metadata.
type UgoiraZipUrls ¶
type UgoiraZipUrls struct {
Medium string `json:"medium"`
}
UgoiraZipUrls contains URLs for ugoira zip files.
type UserBookmarkTag ¶
UserBookmarkTag contains a bookmark tag with count.
type UserBookmarkTagsIllustParams ¶
UserBookmarkTagsIllustParams are the parameters for UserBookmarkTagsIllust.
type UserBookmarkTagsResponse ¶
type UserBookmarkTagsResponse struct {
BookmarkTags []UserBookmarkTag `json:"bookmark_tags"`
NextURL *string `json:"next_url"`
}
UserBookmarkTagsResponse is the response from user_bookmark_tags_illust.
type UserBookmarksIllustParams ¶
type UserBookmarksIllustParams struct {
UserID int
Restrict Restrict
Filter Filter
MaxBookmarkID *int
Tag *string
NoAuth bool
}
UserBookmarksIllustParams are the parameters for UserBookmarksIllust.
type UserBookmarksIllustrations ¶
type UserBookmarksIllustrations struct {
Illusts []IllustrationInfo `json:"illusts"`
NextURL *string `json:"next_url"`
}
UserBookmarksIllustrations is the response from user_bookmarks_illust.
type UserBookmarksNovel ¶
type UserBookmarksNovel struct {
Novels []NovelInfo `json:"novels"`
NextURL *string `json:"next_url"`
}
UserBookmarksNovel is the response from user_bookmarks_novel.
type UserBookmarksNovelParams ¶
type UserBookmarksNovelParams struct {
UserID int
Restrict Restrict
Filter Filter
MaxBookmarkID *int
Tag *string
NoAuth bool
}
UserBookmarksNovelParams are the parameters for UserBookmarksNovel.
type UserDetailParams ¶
UserDetailParams are the parameters for UserDetail.
type UserEditAIShowSettingsParams ¶
UserEditAIShowSettingsParams are the parameters for UserEditAIShowSettings.
type UserFollowAddParams ¶
UserFollowAddParams are the parameters for UserFollowAdd.
type UserFollowDeleteParams ¶
UserFollowDeleteParams are the parameters for UserFollowDelete.
type UserFollowerParams ¶
UserFollowerParams are the parameters for UserFollower.
type UserFollowing ¶
type UserFollowing struct {
UserPreviews []UserPreview `json:"user_previews"`
NextURL *string `json:"next_url"`
}
UserFollowing is the response from user_following.
type UserFollowingParams ¶
UserFollowingParams are the parameters for UserFollowing.
type UserIllustrations ¶
type UserIllustrations struct {
User UserInfo `json:"user"`
Illusts []IllustrationInfo `json:"illusts"`
NextURL *string `json:"next_url"`
}
UserIllustrations is the response from user_illusts.
type UserIllustsParams ¶
type UserIllustsParams struct {
UserID int
Type IllustType
Filter Filter
Offset *int
NoAuth bool
}
UserIllustsParams are the parameters for UserIllusts.
type UserInfo ¶
type UserInfo struct {
ID FlexInt `json:"id"`
Name string `json:"name"`
Account string `json:"account"`
ProfileImageUrls ProfileImageUrls `json:"profile_image_urls"`
Comment *string `json:"comment,omitempty"`
IsFollowed *bool `json:"is_followed"`
IsAccessBlockingUser *bool `json:"is_access_blocking_user,omitempty"`
IsAcceptRequest *bool `json:"is_accept_request,omitempty"`
}
UserInfo contains basic user information.
type UserInfoDetailed ¶
type UserInfoDetailed struct {
User UserInfo `json:"user"`
Profile Profile `json:"profile"`
ProfilePublicity ProfilePublicity `json:"profile_publicity"`
Workspace Workspace `json:"workspace"`
}
UserInfoDetailed is the response from user_detail.
type UserListParams ¶
UserListParams are the parameters for UserList.
type UserListResponse ¶
type UserListResponse struct {
UserPreviews []UserPreview `json:"user_previews"`
NextURL *string `json:"next_url"`
}
UserListResponse is a generic response containing user previews. Used by user_follower, user_mypixiv, user_list, user_related, user_recommended.
type UserMyPixivParams ¶
UserMyPixivParams are the parameters for UserMyPixiv.
type UserNovels ¶
type UserNovels struct {
User UserInfo `json:"user"`
Novels []NovelInfo `json:"novels"`
NextURL *string `json:"next_url"`
}
UserNovels is the response from user_novels.
type UserNovelsParams ¶
UserNovelsParams are the parameters for UserNovels.
type UserPreview ¶
type UserPreview struct {
User UserInfo `json:"user"`
Illusts []IllustrationInfo `json:"illusts"`
Novels []NovelInfo `json:"novels"`
IsMuted bool `json:"is_muted"`
}
UserPreview contains a user with sample works.
type UserRecommendedParams ¶
UserRecommendedParams are the parameters for UserRecommended.
type UserRelatedParams ¶
UserRelatedParams are the parameters for UserRelated.
type WebviewNovel ¶
type WebviewNovel struct {
ID string `json:"id"`
Title string `json:"title"`
SeriesID *string `json:"seriesId"`
SeriesTitle *string `json:"seriesTitle"`
SeriesIsWatched *bool `json:"seriesIsWatched"`
UserID string `json:"userId"`
CoverURL string `json:"coverUrl"`
Tags []string `json:"tags"`
Caption string `json:"caption"`
CDate string `json:"cdate"`
Rating NovelRating `json:"rating"`
Text string `json:"text"`
Marker *string `json:"marker"`
Illusts []string `json:"illusts"`
Images []string `json:"images"`
GlossaryItems []string `json:"glossaryItems"`
ReplaceableItemIDs []string `json:"replaceableItemIds"`
AIType int `json:"aiType"`
IsOriginal bool `json:"isOriginal"`
}
WebviewNovel contains novel content extracted from webview HTML. Fields use camelCase JSON tags matching the embedded JSON format.
type WebviewNovelParams ¶
type WebviewNovelParams struct {
NovelID int
Raw bool // if true, returns raw HTML instead of parsed model
NoAuth bool
}
WebviewNovelParams are the parameters for WebviewNovel.
type WebviewNovelResult ¶
type WebviewNovelResult struct {
Novel *WebviewNovel
RawHTML string
}
WebviewNovelResult holds the result of WebviewNovel. Either Novel or RawHTML is set, depending on the Raw parameter.
type Workspace ¶
type Workspace struct {
PC string `json:"pc"`
Monitor string `json:"monitor"`
Tool string `json:"tool"`
Scanner string `json:"scanner"`
Tablet string `json:"tablet"`
Mouse string `json:"mouse"`
Printer string `json:"printer"`
Desktop string `json:"desktop"`
Music string `json:"music"`
Desk string `json:"desk"`
Chair string `json:"chair"`
Comment string `json:"comment"`
WorkspaceImageURL *string `json:"workspace_image_url"`
}
Workspace contains user workspace information.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bypass provides DNS-over-HTTPS resolution and SNI bypass for accessing Pixiv from restricted networks (e.g., behind the GFW).
|
Package bypass provides DNS-over-HTTPS resolution and SNI bypass for accessing Pixiv from restricted networks (e.g., behind the GFW). |
|
examples
|
|
|
basic
command
|
|
|
download
command
|