Documentation ¶
Index ¶
- Variables
- func S256(bytes []byte) string
- type PixivMobile
- func (pixiv *PixivMobile) GetMultipleArtworkDetails(artworkIds []string, downloadPath string) ([]*httpfuncs.ToDownload, []*models.Ugoira)
- func (pixiv *PixivMobile) GetMultipleIllustratorPosts(userIds, pageNums []string, downloadPath, artworkType string) ([]*httpfuncs.ToDownload, []*models.Ugoira)
- func (pixiv *PixivMobile) SendRequest(reqArgs *httpfuncs.RequestArgs) (*http.Response, error)
- func (pixiv *PixivMobile) Sleep()
- func (pixiv *PixivMobile) StartOauthFlow() error
- func (pixiv *PixivMobile) TagSearch(tagName, downloadPath, pageNum string, dlOptions *PixivMobileDlOptions) ([]*httpfuncs.ToDownload, []*models.Ugoira, bool, bool)
- type PixivMobileDlOptions
Constants ¶
This section is empty.
Variables ¶
var ( ACCEPTED_SORT_ORDER = []string{ "date", "date_d", "popular", "popular_d", "popular_male", "popular_male_d", "popular_female", "popular_female_d", } ACCEPTED_SEARCH_MODE = []string{ "s_tag", "s_tag_full", "s_tc", } ACCEPTED_RATING_MODE = []string{ "safe", "r18", "all", } ACCEPTED_ARTWORK_TYPE = []string{ "illust_and_ugoira", "manga", "all", } )
Functions ¶
Types ¶
type PixivMobile ¶
type PixivMobile struct { // Prog bar ArtworkProgress progress.Progress IllustratorProgress progress.Progress // contains filtered or unexported fields }
func NewPixivMobile ¶
func NewPixivMobile(refreshToken string, timeout int, ctx context.Context) *PixivMobile
Get a new PixivMobile structure
func (*PixivMobile) GetMultipleArtworkDetails ¶
func (pixiv *PixivMobile) GetMultipleArtworkDetails(artworkIds []string, downloadPath string) ([]*httpfuncs.ToDownload, []*models.Ugoira)
func (*PixivMobile) GetMultipleIllustratorPosts ¶
func (pixiv *PixivMobile) GetMultipleIllustratorPosts(userIds, pageNums []string, downloadPath, artworkType string) ([]*httpfuncs.ToDownload, []*models.Ugoira)
func (*PixivMobile) SendRequest ¶
func (pixiv *PixivMobile) SendRequest(reqArgs *httpfuncs.RequestArgs) (*http.Response, error)
Sends a request to the Pixiv API and refreshes the access token if required
Returns the JSON interface and errors if any
func (*PixivMobile) Sleep ¶
func (pixiv *PixivMobile) Sleep()
This is due to Pixiv's strict rate limiting.
Without delays, the user might get 429 too many requests or the user's account might get suspended.
Additionally, pixiv.net is protected by cloudflare, so to prevent the user's IP reputation from going down, delays are added.
func (*PixivMobile) StartOauthFlow ¶
func (pixiv *PixivMobile) StartOauthFlow() error
Start the OAuth flow to get the refresh token
func (*PixivMobile) TagSearch ¶
func (pixiv *PixivMobile) TagSearch(tagName, downloadPath, pageNum string, dlOptions *PixivMobileDlOptions) ([]*httpfuncs.ToDownload, []*models.Ugoira, bool, bool)
Query Pixiv's API (mobile) to get the JSON of a search query Returns the ToDownload slice, Ugoira slice, boolean indicating if there was an error, and boolean indicating if the context was cancelled
type PixivMobileDlOptions ¶
type PixivMobileDlOptions struct { // Sort order of the results. Can be "date_desc" or "date_asc". SortOrder string SearchMode string RatingMode string ArtworkType string Configs *configs.Config MobileClient *PixivMobile RefreshToken string Notifier notify.Notifier // Prog bar TagSearchProgBar progress.Progress // contains filtered or unexported fields }
PixivToDl is the struct that contains the arguments of Pixiv download options.
func (*PixivMobileDlOptions) GetCancel ¶
func (p *PixivMobileDlOptions) GetCancel() context.CancelFunc
func (*PixivMobileDlOptions) GetContext ¶
func (p *PixivMobileDlOptions) GetContext() context.Context
func (*PixivMobileDlOptions) SetContext ¶
func (p *PixivMobileDlOptions) SetContext(ctx context.Context)
func (*PixivMobileDlOptions) ValidateArgs ¶
func (p *PixivMobileDlOptions) ValidateArgs(userAgent string) error
ValidateArgs validates the arguments of the Pixiv download options.
Should be called after initialising the struct.