Documentation ¶
Index ¶
- func DlFantiaPost(count, maxCount int, postId string, dlOptions *FantiaDlOptions) (cancelled bool, gdriveUrls []*httpfuncs.ToDownload, errSlice []error)
- func SolveCaptcha(captchaOptions CaptchaOptions) error
- type CaptchaOptions
- type FantiaContent
- type FantiaDl
- type FantiaDlOptions
- func (f *FantiaDlOptions) CancelCtx()
- func (f *FantiaDlOptions) CtxIsActive() bool
- func (f *FantiaDlOptions) GetConfigs() *configs.Config
- func (f *FantiaDlOptions) GetContext() context.Context
- func (f *FantiaDlOptions) GetCsrfToken(userAgent string) error
- func (f *FantiaDlOptions) GetNotifier() notify.Notifier
- func (f *FantiaDlOptions) GetSessionCookies() []*http.Cookie
- func (f *FantiaDlOptions) SetContext(ctx context.Context)
- func (f *FantiaDlOptions) ValidateArgs(userAgent string) error
- type FantiaPost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DlFantiaPost ¶
func DlFantiaPost(count, maxCount int, postId string, dlOptions *FantiaDlOptions) (cancelled bool, gdriveUrls []*httpfuncs.ToDownload, errSlice []error)
func SolveCaptcha ¶ added in v1.1.0
func SolveCaptcha(captchaOptions CaptchaOptions) error
Types ¶
type CaptchaOptions ¶ added in v1.1.0
type FantiaContent ¶
type FantiaContent struct { // Any attachments such as pdfs that are on their dedicated section AttachmentURI string `json:"attachment_uri"` // For images that are uploaded to their own section PostContentPhotos []struct { ID int `json:"id"` URL struct { Original string `json:"original"` } `json:"url"` } `json:"post_content_photos"` // For images that are embedded in the post content blocks. // Could also contain links to other external file hosting providers. Comment string `json:"comment"` // for attachments such as pdfs that are embedded in the post content DownloadUri string `json:"download_uri"` Filename string `json:"filename"` }
type FantiaDl ¶
FantiaDl is the struct that contains the IDs of the Fantia fanclubs and posts to download.
func (*FantiaDl) DlFantiaPosts ¶
func (f *FantiaDl) DlFantiaPosts(dlOptions *FantiaDlOptions) ([]*httpfuncs.ToDownload, []error)
Query Fantia's API based on the slice of post IDs and get a map of urls to download from.
Note that only the downloading of the URL(s) is/are executed concurrently to reduce the chance of the signed AWS S3 URL(s) from expiring before the download is executed or completed due to a download queue to avoid resource exhaustion of the user's system.
func (*FantiaDl) GetCreatorsPosts ¶
func (f *FantiaDl) GetCreatorsPosts(dlOptions *FantiaDlOptions) []error
Retrieves all the posts based on the slice of creator IDs and updates its PostIds slice
func (*FantiaDl) ValidateArgs ¶
ValidateArgs validates the IDs of the Fantia fanclubs and posts to download.
It also validates the page numbers of the fanclubs to download.
Should be called after initialising the struct.
type FantiaDlOptions ¶
type FantiaDlOptions struct { DlThumbnails bool DlImages bool DlAttachments bool DlGdrive bool DetectOtherDlLinks bool BaseDownloadDirPath string GdriveClient *gdrive.GDrive Configs *configs.Config SessionCookieId string SessionCookies []*http.Cookie CsrfToken string Notifier notify.Notifier // Progress indicators MainProgBar progress.ProgressBar DownloadProgressBars *[]*progress.DownloadProgressBar // contains filtered or unexported fields }
FantiaDlOptions is the struct that contains the options for downloading from Fantia.
func (*FantiaDlOptions) CancelCtx ¶ added in v1.1.0
func (f *FantiaDlOptions) CancelCtx()
CancelCtx releases the resources used and cancels the context of the FantiaDlOptions struct.
func (*FantiaDlOptions) CtxIsActive ¶ added in v1.1.0
func (f *FantiaDlOptions) CtxIsActive() bool
func (*FantiaDlOptions) GetConfigs ¶
func (f *FantiaDlOptions) GetConfigs() *configs.Config
func (*FantiaDlOptions) GetContext ¶
func (f *FantiaDlOptions) GetContext() context.Context
func (*FantiaDlOptions) GetCsrfToken ¶
func (f *FantiaDlOptions) GetCsrfToken(userAgent string) error
GetCsrfToken gets the CSRF token from Fantia's index HTML which is required to communicate with their API.
func (*FantiaDlOptions) GetNotifier ¶
func (f *FantiaDlOptions) GetNotifier() notify.Notifier
func (*FantiaDlOptions) GetSessionCookies ¶
func (f *FantiaDlOptions) GetSessionCookies() []*http.Cookie
func (*FantiaDlOptions) SetContext ¶
func (f *FantiaDlOptions) SetContext(ctx context.Context)
func (*FantiaDlOptions) ValidateArgs ¶
func (f *FantiaDlOptions) ValidateArgs(userAgent string) error
ValidateArgs validates the options for downloading from Fantia.
Should be called after initialising the struct.
type FantiaPost ¶
type FantiaPost struct { Post struct { ID int `json:"id"` Comment string `json:"comment"` // the main post content Title string `json:"title"` Thumb struct { Original string `json:"original"` } `json:"thumb"` Fanclub struct { User struct { Name string `json:"name"` } `json:"user"` } `json:"fanclub"` Status string `json:"status"` PostContents []FantiaContent `json:"post_contents"` } `json:"post"` Redirect string `json:"redirect"` // if get flagged by the system, it will redirect to this recaptcha url }