gopixiv

package module
v0.0.0-...-a9dfd53 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: GPL-3.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gopixiv Go Report Card

Pixiv API for Golang (with Auth supported)

Forked from: https://github.com/everpcpc/pixiv

Example

account, err := pixiv.Login("username", "password")
app := pixiv.NewApp()
user, err := app.UserDetail(uid)
illusts, next, err := app.UserIllusts(uid, "illust", 0)
illusts, next, err := app.UserBookmarksIllust(uid, "public", 0, "")
illusts, next, err := app.IllustFollow("public", 0)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HookAuth

func HookAuth(f func(string, string, time.Time) error)

HookAuth add a hook with (token, refreshToken, tokenDeadline) after a successful auth. Prividing a way to store the latest token.

Types

type Account

type Account struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	Account          string `json:"account"`
	MailAddress      string `json:"mail_address"`
	IsPremium        bool   `json:"is_premium"`
	XRestrict        int    `json:"x_restrict"`
	IsMailAuthorized bool   `json:"is_mail_authorized"`

	ProfileImage AccountProfileImages `json:"profile_image_urls"`
}

func LoadAuth

func LoadAuth(token, refreshToken string, tokenDeadline time.Time) (*Account, error)

func LoadAuthWithRefreshToken

func LoadAuthWithRefreshToken(refreshToken string) (*Account, error)

func Login

func Login(username, password string) (*Account, error)

type AccountProfileImages

type AccountProfileImages struct {
	Px16  string `json:"px_16x16"`
	Px50  string `json:"px_50x50"`
	Px170 string `json:"px_170x170"`
}

type AppPixivAPI

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

AppPixivAPI -- App-API (6.x - app-api.pixiv.net)

func NewApp

func NewApp() *AppPixivAPI

func (*AppPixivAPI) Download

func (a *AppPixivAPI) Download(id uint64, path string) (sizes []int64, err error)

Download a specific picture from pixiv id

func (*AppPixivAPI) IllustBookmarkAdd

func (a *AppPixivAPI) IllustBookmarkAdd(illustID uint64, restrict string, tags []string) error

IllustBookmarkAdd Add bookmark

func (*AppPixivAPI) IllustBookmarkDelete

func (a *AppPixivAPI) IllustBookmarkDelete(illustID uint64) error

IllustBookmarkDelete Remove bookmark

func (*AppPixivAPI) IllustBookmarkDetail

func (a *AppPixivAPI) IllustBookmarkDetail(illustID uint64) (*IllustBookmarkDetail, error)

IllustBookmarkDetail Bookmark details

func (*AppPixivAPI) IllustCommentAdd

func (a *AppPixivAPI) IllustCommentAdd(illustID uint64, comment string, parentCommentID int) (*IllustCommentAddResult, error)

IllustCommentAdd adds a comment to given illustID

func (*AppPixivAPI) IllustComments

func (a *AppPixivAPI) IllustComments(illustID uint64, offset int, includeTotalComments bool) (*IllustComments, error)

IllustComments Comments posted in a pixiv artwork

func (*AppPixivAPI) IllustDetail

func (a *AppPixivAPI) IllustDetail(id uint64) (*Illust, error)

IllustDetail get a detailed illust with id

func (*AppPixivAPI) IllustFollow

func (a *AppPixivAPI) IllustFollow(restrict string, offset int) ([]Illust, int, error)

IllustFollow restrict: [public, private]

func (*AppPixivAPI) IllustRanking

func (a *AppPixivAPI) IllustRanking(mode string, filter string, date string, offset string) (*IllustsResponse, error)

IllustRanking Ranking of works

mode: [day, week, month, day_male, day_female, week_original, week_rookie, day_manga]

date: yyyy-mm-dd

func (*AppPixivAPI) IllustRecommended

func (a *AppPixivAPI) IllustRecommended(contentType string, includeRankingLabel bool, filter string, maxBookmarkIDForRecommended string, minBookmarkIDForRecentIllust string, offset int, includeRankingIllusts bool, bookmarkIllustIDs []string, includePrivacyPolicy string, requireAuth bool) (*IllustRecommended, error)

IllustRecommended Home Recommendation

contentType: [illust, manga]

func (*AppPixivAPI) IllustRelated

func (a *AppPixivAPI) IllustRelated(illustID uint64, filter string, seedIllustIDs []string) (*IllustsResponse, error)

IllustRelated returns Related works

func (*AppPixivAPI) SearchIllust

func (a *AppPixivAPI) SearchIllust(word string, searchTarget string, sort string, duration string, filter string, offset int) (*SearchIllustResult, error)

SearchIllust search for

searchTarget - Search type

"partial_match_for_tags"  - The label part is consistent
"exact_match_for_tags"    - The labels are exactly the same
"title_and_caption"       - Title description

sort: [date_desc, date_asc]

duration: [within_last_day, within_last_week, within_last_month]

func (*AppPixivAPI) ShowcaseArticle

func (a *AppPixivAPI) ShowcaseArticle(showcaseID string) (*ShowcaseArticle, error)

ShowcaseArticle Special feature details (disguised as Chrome)

func (*AppPixivAPI) TrendingTagsIllust

func (a *AppPixivAPI) TrendingTagsIllust(filter string) (*TrendingTagsIllust, error)

TrendingTagsIllust Trend label

func (*AppPixivAPI) UgoiraMetadata

func (a *AppPixivAPI) UgoiraMetadata(illustID uint64) (*UgoiraMetadata, error)

UgoiraMetadata Ugoira Info

func (*AppPixivAPI) UserBookmarkTagsIllust

func (a *AppPixivAPI) UserBookmarkTagsIllust(restrict string, offset int) (*UserBookmarkTags, error)

UserBookmarkTagsIllust User favorite tag list

func (*AppPixivAPI) UserBookmarksIllust

func (a *AppPixivAPI) UserBookmarksIllust(uid uint64, restrict string, maxBookmarkID int, tag string) ([]Illust, int, error)

UserBookmarksIllust restrict: [public, private]

func (*AppPixivAPI) UserDetail

func (a *AppPixivAPI) UserDetail(uid uint64) (*UserDetail, error)

func (*AppPixivAPI) UserFollowAdd

func (a *AppPixivAPI) UserFollowAdd(userID uint64, restrict string) error

UserFollowAdd Follow users

func (*AppPixivAPI) UserFollowDelete

func (a *AppPixivAPI) UserFollowDelete(userID uint64, restrict string) error

UserFollowDelete Unfollow users

func (*AppPixivAPI) UserFollower

func (a *AppPixivAPI) UserFollower(userID uint64, restrict string, offset int) (*UserFollowList, error)

UserFollower Follower user list

func (*AppPixivAPI) UserFollowing

func (a *AppPixivAPI) UserFollowing(userID uint64, restrict string, offset int) (*UserFollowList, error)

UserFollowing Following user list

func (*AppPixivAPI) UserIllusts

func (a *AppPixivAPI) UserIllusts(uid uint64, _type string, offset int) ([]Illust, int, error)

UserIllusts type: [illust, manga]

func (*AppPixivAPI) UserList

func (a *AppPixivAPI) UserList(userID uint64, filter string, offset int) (*UserList, error)

UserList Blacklisted users

func (*AppPixivAPI) UserMyPixiv

func (a *AppPixivAPI) UserMyPixiv(userID uint64, offset int) (*UserFollowList, error)

UserMyPixiv Users in MyPixiv

func (*AppPixivAPI) WithDownloadProxy

func (a *AppPixivAPI) WithDownloadProxy(proxy *url.URL) *AppPixivAPI

func (*AppPixivAPI) WithDownloadTimeout

func (a *AppPixivAPI) WithDownloadTimeout(timeout time.Duration) *AppPixivAPI

type Body

type Body struct {
	ID                      string           `json:"id"`
	Lang                    string           `json:"lang"`
	Entry                   Entry            `json:"entry"`
	Tags                    []Tag            `json:"tags"`
	ThumbnailURL            string           `json:"thumbnailUrl"`
	Title                   string           `json:"title"`
	PublishDate             int              `json:"publishDate"`
	Category                string           `json:"category"`
	SubCategory             string           `json:"subCategory"`
	SubCategoryLabel        string           `json:"subCategoryLabel"`
	SubCategoryIntroduction string           `json:"subCategoryIntroduction"`
	Introduction            string           `json:"introduction"`
	Footer                  string           `json:"footer"`
	Illusts                 []BodyIllust     `json:"illusts"`
	RelatedArticles         []RelatedArticle `json:"relatedArticles"`
	FollowingUserIDs        []interface{}    `json:"followingUserIds"`
	IsOnlyOneUser           bool             `json:"isOnlyOneUser"`
}

type BodyIllust

type BodyIllust struct {
	SpotlightArticleID                  int         `json:"spotlight_article_id"`
	IllustID                            int         `json:"illust_id"`
	Description                         string      `json:"description"`
	Language                            string      `json:"language"`
	IllustUserID                        string      `json:"illust_user_id"`
	IllustTitle                         string      `json:"illust_title"`
	IllustExt                           string      `json:"illust_ext"`
	IllustWidth                         string      `json:"illust_width"`
	IllustHeight                        string      `json:"illust_height"`
	IllustRestrict                      string      `json:"illust_restrict"`
	IllustXRestrict                     string      `json:"illust_x_restrict"`
	IllustCreateDate                    string      `json:"illust_create_date"`
	IllustUploadDate                    string      `json:"illust_upload_date"`
	IllustServerID                      string      `json:"illust_server_id"`
	IllustHash                          string      `json:"illust_hash"`
	IllustType                          string      `json:"illust_type"`
	IllustSanityLevel                   int         `json:"illust_sanity_level"`
	IllustBookStyle                     string      `json:"illust_book_style"`
	IllustPageCount                     string      `json:"illust_page_count"`
	IllustCustomThumbnailUploadDatetime interface{} `json:"illust_custom_thumbnail_upload_datetime"`
	IllustComment                       string      `json:"illust_comment"`
	UserAccount                         string      `json:"user_account"`
	UserName                            string      `json:"user_name"`
	UserComment                         string      `json:"user_comment"`
	URL                                 URL         `json:"url"`
	UgoiraMeta                          interface{} `json:"ugoira_meta"`
	UserIcon                            string      `json:"user_icon"`
}

type BookmarkDetail

type BookmarkDetail struct {
	IsBookmarked bool                `json:"is_bookmarked"`
	Tags         []BookmarkDetailTag `json:"tags"`
	Restrict     string              `json:"restrict"`
}

type BookmarkDetailTag

type BookmarkDetailTag struct {
	Name         string `json:"name"`
	IsRegistered bool   `json:"is_registered"`
}

type Comment

type Comment struct {
	ID             uint64   `json:"id"`
	CommentComment string   `json:"comment"`
	Date           string   `json:"date"`
	User           *User    `json:"user"`
	HasReplies     bool     `json:"has_replies"`
	ParentComment  *Comment `json:"parent_comment"`
}

type Entry

type Entry struct {
	ID                        string                `json:"id"`
	Title                     string                `json:"title"`
	PureTitle                 string                `json:"pure_title"`
	Catchphrase               string                `json:"catchphrase"`
	Header                    string                `json:"header"`
	Body                      string                `json:"body"`
	Footer                    string                `json:"footer"`
	Sidebar                   string                `json:"sidebar"`
	PublishDate               int                   `json:"publish_date"`
	Language                  string                `json:"language"`
	PixivisionCategorySlug    string                `json:"pixivision_category_slug"`
	PixivisionCategory        PixivisionCategory    `json:"pixivision_category"`
	PixivisionSubcategorySlug string                `json:"pixivision_subcategory_slug"`
	PixivisionSubcategory     PixivisionSubcategory `json:"pixivision_subcategory"`
	Tags                      []Tag                 `json:"tags"`
	ArticleURL                string                `json:"article_url"`
	Intro                     string                `json:"intro"`
	FacebookCount             string                `json:"facebook_count"`
	TwitterCount              string                `json:"twitter_count"`
}

type Frame

type Frame struct {
	File  string `json:"file"`
	Delay int    `json:"delay"`
}

type Illust

type Illust struct {
	ID             uint64          `json:"id"`
	Title          string          `json:"title"`
	Type           string          `json:"type"`
	Images         *Images         `json:"image_urls"`
	Caption        string          `json:"caption"`
	Restrict       int             `json:"restrict"`
	User           *User           `json:"user"`
	Tags           []Tag           `json:"tags"`
	Tools          []string        `json:"tools"`
	CreateData     string          `json:"create_data"`
	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"`
	TotalComments  int             `json:"total_comments"`
}

type IllustBookmarkDetail

type IllustBookmarkDetail struct {
	BookmarkDetail BookmarkDetail `json:"bookmark_detail"`
}

type IllustCommentAddResult

type IllustCommentAddResult struct {
	Comment Comment `json:"comment"`
}

type IllustComments

type IllustComments struct {
	TotalComments uint64    `json:"total_comments"`
	Comments      []Comment `json:"comments"`
	NextURL       string    `json:"next_url"`
}

type IllustRecommended

type IllustRecommended struct {
	Illusts        []Illust       `json:"illusts"`
	RankingIllusts []interface{}  `json:"ranking_illusts"`
	ContestExists  bool           `json:"contest_exists"`
	PrivacyPolicy  *PrivacyPolicy `json:"privacy_policy"`
	NextURL        string         `json:"next_url"`
}

type IllustResponse

type IllustResponse struct {
	Illust Illust `json:"illust"`
}

type IllustsResponse

type IllustsResponse struct {
	Illusts []Illust `json:"illusts"`
	NextURL string   `json:"next_url"`
}

type Images

type Images struct {
	SquareMedium string `json:"square_medium"`
	Medium       string `json:"medium"`
	Large        string `json:"large"`
	Original     string `json:"original"`
}

type MetaPage

type MetaPage struct {
	Images Images `json:"image_urls"`
}

type MetaSinglePage

type MetaSinglePage struct {
	OriginalImageURL string `json:"original_image_url"`
}

type Perror

type Perror struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type PixivisionCategory

type PixivisionCategory struct {
	Label        string `json:"label"`
	Introduction string `json:"introduction"`
}

type PixivisionSubcategory

type PixivisionSubcategory struct {
	Label        string `json:"label"`
	LabelEn      string `json:"label_en"`
	Title        string `json:"title"`
	Introduction string `json:"introduction"`
	ImageURL     string `json:"image_url"`
	BigImageURL  string `json:"big_image_url"`
}

type PrivacyPolicy

type PrivacyPolicy struct {
}

type Profile

type Profile struct {
	Webpage                    interface{} `json:"webpage"`
	Gender                     string      `json:"gender"`
	Birth                      string      `json:"birth"`
	BirthDay                   string      `json:"birth_day"`
	BirthYear                  uint64      `json:"birth_year"`
	Region                     string      `json:"region"`
	AddressID                  uint64      `json:"address_id"`
	CountryCode                string      `json:"country_code"`
	Job                        string      `json:"job"`
	JobID                      uint64      `json:"job_id"`
	TotalFollowUsers           uint64      `json:"total_follow_users"`
	TotalMypixivUsers          uint64      `json:"total_mypixiv_users"`
	TotalIllusts               uint64      `json:"total_illusts"`
	TotalManga                 uint64      `json:"total_manga"`
	TotalNovels                uint64      `json:"total_novels"`
	TotalIllustBookmarksPublic uint64      `json:"total_illust_bookmarks_public"`
	TotalIllustSeries          uint64      `json:"total_illust_series"`
	TotalNovelSeries           uint64      `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"`
}

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"`
}

type RelatedArticle

type RelatedArticle struct {
	ID                        string        `json:"id"`
	Ja                        PrivacyPolicy `json:"ja"`
	En                        PrivacyPolicy `json:"en"`
	Zh                        PrivacyPolicy `json:"zh"`
	ZhTw                      PrivacyPolicy `json:"zh_tw"`
	PublishDate               int           `json:"publish_date"`
	Category                  string        `json:"category"`
	PixivisionCategorySlug    string        `json:"pixivision_category_slug"`
	PixivisionSubcategorySlug string        `json:"pixivision_subcategory_slug"`
	Thumbnail                 string        `json:"thumbnail"`
	ThumbnailIllustID         string        `json:"thumbnail_illust_id"`
	HasBody                   string        `json:"has_body"`
	IsPr                      string        `json:"is_pr"`
	PrClientName              string        `json:"pr_client_name"`
	EditStatus                string        `json:"edit_status"`
	TranslationStatus         string        `json:"translation_status"`
	IsSample                  string        `json:"is_sample"`
	Illusts                   []interface{} `json:"illusts"`
	NovelIDs                  []interface{} `json:"novel_ids"`
	Memo                      string        `json:"memo"`
	FacebookCount             string        `json:"facebook_count"`
	TweetCount                string        `json:"tweet_count"`
	TweetMaxCount             string        `json:"tweet_max_count"`
	Tags                      []interface{} `json:"tags"`
	TagIDs                    interface{}   `json:"tag_ids"`
	NumberedTags              []interface{} `json:"numbered_tags"`
	MainAbtestPatternID       string        `json:"main_abtest_pattern_id"`
	AdvertisementID           string        `json:"advertisement_id"`
}

type SearchIllustResult

type SearchIllustResult struct {
	Illusts         []Illust `json:"illusts"`
	NextURL         string   `json:"next_url"`
	SearchSpanLimit int      `json:"search_span_limit"`
}

type Series

type Series struct {
	ID    uint64 `json:"id"`
	Title string `json:"title"`
}

type ShowcaseArticle

type ShowcaseArticle struct {
	Error   bool   `json:"error"`
	Message string `json:"message"`
	Body    []Body `json:"body"`
}

type Tag

type Tag struct {
	Name           string `json:"name"`
	TranslatedName string `json:"translated_name"`
}

type TrendTag

type TrendTag struct {
	Tag            string  `json:"tag"`
	TranslatedName string  `json:"translated_name"`
	Illust         *Illust `json:"illust"`
}

type TrendingTagsIllust

type TrendingTagsIllust struct {
	TrendTags []TrendTag `json:"trend_tags"`
}

type URL

type URL struct {
	The1200X1200    string `json:"1200x1200"`
	The768X1200     string `json:"768x1200"`
	Ugoira600X600   string `json:"ugoira600x600"`
	Ugoira1920X1080 string `json:"ugoira1920x1080"`
}

type UgoiraMetadata

type UgoiraMetadata struct {
	UgoiraMetadataUgoiraMetadata UgoiraMetadataClass `json:"ugoira_metadata"`
}

type UgoiraMetadataClass

type UgoiraMetadataClass struct {
	ZipURLs UserImages `json:"zip_urls"`
	Frames  []Frame    `json:"frames"`
}

type User

type User struct {
	ID         uint64 `json:"id"`
	Name       string `json:"name"`
	Account    string `json:"account"`
	Comment    string `json:"comment"`
	IsFollowed bool   `json:"is_followed"`

	ProfileImages *UserImages `json:"profile_image_urls"`
}

type UserBookmarkTags

type UserBookmarkTags struct {
	BookmarkTags []interface{} `json:"bookmark_tags"`
	NextURL      string        `json:"next_url"`
}

type UserDetail

type UserDetail struct {
	User             *User             `json:"user"`
	Profile          *Profile          `json:"profile"`
	ProfilePublicity *ProfilePublicity `json:"profile_publicity"`
	Workspace        *Workspace        `json:"workspace"`
}

type UserFollowList

type UserFollowList struct {
	UserPreviews []UserPreview `json:"user_previews"`
	NextURL      string        `json:"next_url"`
}

type UserImages

type UserImages struct {
	Medium string `json:"medium"`
}

type UserList

type UserList struct {
	Users []interface{} `json:"users"`
}

type UserPreview

type UserPreview struct {
	User    User          `json:"user"`
	Illusts []Illust      `json:"illusts"`
	Novels  []interface{} `json:"novels"`
	IsMuted bool          `json:"is_muted"`
}

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"`
}

Jump to

Keyboard shortcuts

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