pixivfanbox

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPixivFanboxHeaders

func GetPixivFanboxHeaders() map[string]string

Returns a defined request header needed to communicate with Pixiv Fanbox's API

Types

type CreatorPaginatedPostsJson

type CreatorPaginatedPostsJson struct {
	Body []string `json:"body"`
}

type FanboxArticleBlocks

type FanboxArticleBlocks []struct {
	Type    string `json:"type"`
	Text    string `json:"text,omitempty"`
	ImageID string `json:"imageId,omitempty"`
	Styles  []struct {
		Type   string `json:"type"`
		Offset int    `json:"offset"`
		Length int    `json:"length"`
	} `json:"styles,omitempty"`
	Links []struct {
		Offset int    `json:"offset"`
		Length int    `json:"length"`
		Url    string `json:"url"`
	} `json:"links,omitempty"`
	FileID string `json:"fileId,omitempty"`
}

type FanboxArticleJson

type FanboxArticleJson struct {
	Blocks   FanboxArticleBlocks `json:"blocks"`
	ImageMap map[string]struct {
		ID           string `json:"id"`
		Extension    string `json:"extension"`
		Width        int    `json:"width"`
		Height       int    `json:"height"`
		OriginalUrl  string `json:"originalUrl"`
		ThumbnailUrl string `json:"thumbnailUrl"`
	} `json:"imageMap"`
	FileMap map[string]struct {
		ID        string `json:"id"`
		Name      string `json:"name"`
		Extension string `json:"extension"`
		Size      int    `json:"size"`
		Url       string `json:"url"`
	} `json:"fileMap"`
}

type FanboxCreatorPostsJson

type FanboxCreatorPostsJson struct {
	Body struct {
		Items []struct {
			Id string `json:"id"`
		} `json:"items"`
	} `json:"body"`
}

type FanboxFilePostJson

type FanboxFilePostJson struct {
	Text  string `json:"text"`
	Files []struct {
		ID        string `json:"id"`
		Name      string `json:"name"`
		Extension string `json:"extension"`
		Size      int    `json:"size"`
		Url       string `json:"url"`
	} `json:"files"`
}

type FanboxImagePostJson

type FanboxImagePostJson struct {
	Text   string `json:"text"`
	Images []struct {
		ID           string `json:"id"`
		Extension    string `json:"extension"`
		Width        int    `json:"width"`
		Height       int    `json:"height"`
		OriginalUrl  string `json:"originalUrl"`
		ThumbnailUrl string `json:"thumbnailUrl"`
	} `json:"images"`
}

type FanboxPostJson

type FanboxPostJson struct {
	Body struct {
		Id            string          `json:"id"`
		Title         string          `json:"title"`
		Type          string          `json:"type"`
		CreatorId     string          `json:"creatorId"`
		CoverImageUrl string          `json:"coverImageUrl"`
		Body          json.RawMessage `json:"body"`
	} `json:"body"`
}

type FanboxTextPostJson

type FanboxTextPostJson struct {
	Text string `json:"text"`
}

type PixivFanboxDl

type PixivFanboxDl struct {
	CreatorIds      []string
	CreatorPageNums []string

	PostIds []string
}

PixivFanboxDl is the struct that contains the IDs of the Pixiv Fanbox creators and posts to download.

func (*PixivFanboxDl) GetCreatorsPosts

func (pf *PixivFanboxDl) GetCreatorsPosts(dlOptions *PixivFanboxDlOptions) []error

Retrieves all the posts based on the slice of creator IDs and updates its slice of post IDs accordingly

func (*PixivFanboxDl) GetPostDetails

func (pf *PixivFanboxDl) GetPostDetails(dlOptions *PixivFanboxDlOptions) ([]*httpfuncs.ToDownload, []*httpfuncs.ToDownload, []error)

Query Pixiv Fanbox's API based on the slice of post IDs and returns a map of urls and a map of GDrive urls to download from.

func (*PixivFanboxDl) ValidateArgs

func (pf *PixivFanboxDl) ValidateArgs() error

ValidateArgs validates the IDs of the Pixiv Fanbox creators and posts to download.

It also validates the page numbers of the creators to download.

Should be called after initialising the struct.

type PixivFanboxDlOptions

type PixivFanboxDlOptions struct {
	DlThumbnails        bool
	DlImages            bool
	DlAttachments       bool
	DlGdrive            bool
	UseCacheDb          bool
	BaseDownloadDirPath string

	Configs *configs.Config

	// GdriveClient is the Google Drive client to be
	// used in the download process for Pixiv Fanbox posts
	GdriveClient *gdrive.GDrive

	SessionCookieId string
	SessionCookies  []*http.Cookie

	Notifier notify.Notifier

	// Progress indicators
	MainProgBar          progress.ProgressBar
	DownloadProgressBars *[]*progress.DownloadProgressBar
	// contains filtered or unexported fields
}

PixivFanboxDlOptions is the struct that contains the options for downloading from Pixiv Fanbox.

func (*PixivFanboxDlOptions) CancelCtx added in v1.1.0

func (pf *PixivFanboxDlOptions) CancelCtx()

CancelCtx releases the resources used and cancels the context of the PixivFanboxDlOptions struct.

func (*PixivFanboxDlOptions) CtxIsActive added in v1.1.0

func (pf *PixivFanboxDlOptions) CtxIsActive() bool

func (*PixivFanboxDlOptions) GetContext

func (pf *PixivFanboxDlOptions) GetContext() context.Context

func (*PixivFanboxDlOptions) SetContext

func (pf *PixivFanboxDlOptions) SetContext(ctx context.Context)

func (*PixivFanboxDlOptions) ValidateArgs

func (pf *PixivFanboxDlOptions) ValidateArgs(userAgent string) error

ValidateArgs validates the session cookie ID of the Pixiv Fanbox account to download from.

Should be called after initialising the struct.

Jump to

Keyboard shortcuts

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