Documentation ¶
Index ¶
- func CombineStringsWithNewline(strs ...string) string
- func ConvertPageNumToOffset(minPageNum, maxPageNum, perPage int) (int, int)
- func DetectGDriveLinks(text, postFolderPath string, isUrl, logUrls bool) bool
- func DetectOtherExtDLLink(text, postFolderPath string) bool
- func DetectPasswordInText(text string) bool
- func ExecuteChromedpActions(allocCtx context.Context, allocCancelFn context.CancelFunc, ...) error
- func GetCookie(sessionID, website string) *http.Cookie
- func GetDefaultChromedpAlloc(userAgent string, ctx context.Context) (context.Context, context.CancelFunc)
- func GetMinMaxFromStr(numStr string) (int, int, bool, error)
- func GetReadableSiteStr(site string) string
- func HandleCaptchaErr(err error, dlOptions DlOptions, website string) error
- func RemoveDuplicateIdAndPageNum[T SliceTypes](idSlice, pageSlice []T) ([]T, []T)
- func RemoveSliceDuplicates[T SliceTypes](s []T) []T
- func SetChromedpAllocCookies(cookies []*http.Cookie) chromedp.Action
- func SliceContains(arr []string, str string) bool
- func SliceMatchesRegex(regex *regexp.Regexp, slice []string) (bool, string)
- func SolveCaptcha(dlOptions DlOptions, website string) error
- func ValidateIds(args []string) error
- func ValidatePageNumInput(baseSliceLen int, pageNums []string, errMsgs []string) error
- func ValidatePageNumInputPanic(baseSliceLen int, pageNums []string, errMsgs []string)
- func ValidateStrArgs(str string, slice, errMsgs []string) (string, error)
- func VerifyAndGetCookie(website, cookieValue, userAgent string) (*http.Cookie, error)
- func VerifyCookie(cookie *http.Cookie, website, userAgent string) (bool, error)
- type DlOptions
- type SliceTypes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineStringsWithNewline ¶
Same as strings.Join([]string, "\n")
func ConvertPageNumToOffset ¶
Convert the page number to the offset as one page might have x posts.
Usually for paginated results like Pixiv's mobile API (60 per page), checkPixivMax should be set to true.
func DetectGDriveLinks ¶
Detects if the given string contains any GDrive links and logs it if detected
func DetectOtherExtDLLink ¶
Detects if the given string contains any other external file hosting providers links and logs it if detected
func DetectPasswordInText ¶
Detects if the given string contains any passwords
func ExecuteChromedpActions ¶
func GetDefaultChromedpAlloc ¶
func GetMinMaxFromStr ¶
Returns the min, max, hasMaxNum, and error from the given string of "num" or "min-max"
E.g.
"1-10" => 1, 10, true, nil "1" => 1, 1, true, nil "" => 1, 1, false, nil (defaults to min = 1, max = inf)
func GetReadableSiteStr ¶
Returns a readable format of the website name for the user
Will panic if the site string doesn't match one of its cases.
func HandleCaptchaErr ¶
try the alternative method if the first one fails.
E.g. User preferred to solve the reCAPTCHA automatically, but the program failed to do so,
The program will then ask the user to solve the reCAPTCHA manually on their browser with the SAME session.
func RemoveDuplicateIdAndPageNum ¶
func RemoveDuplicateIdAndPageNum[T SliceTypes](idSlice, pageSlice []T) ([]T, []T)
Used for removing duplicate IDs with its corresponding page number from the given slices.
Returns the the new idSlice and pageSlice with the duplicates removed.
func RemoveSliceDuplicates ¶
func RemoveSliceDuplicates[T SliceTypes](s []T) []T
Removes duplicates from the given slice.
func SliceContains ¶
Checks if the given str is in the given arr and returns a boolean
func SliceMatchesRegex ¶
Checks if the slice of string all matches the given regex pattern
Returns true if all matches, false otherwise with the outlier string
func SolveCaptcha ¶
func ValidateIds ¶
Validates if the slice of strings contains only numbers Otherwise, os.Exit(1) is called after printing error messages for the user to read
func ValidatePageNumInput ¶
check page nums if they are in the correct format.
E.g. "1-10" is valid, but "0-9" is not valid because "0" is not accepted If the page nums are not in the correct format, os.Exit(1) is called
func ValidatePageNumInputPanic ¶
Similar to ValidatePageNumInput, but will call os.Exit(1) if the page nums are not in the correct format
func ValidateStrArgs ¶
Checks if the slice of string contains the target str. Otherwise, returns an error.
func VerifyAndGetCookie ¶
Verifies the given cookie by making a request to the website and checks if the cookie is valid If the cookie is valid, the cookie will be returned
However, if the cookie is invalid, an error message will be printed out and the program will shutdown
Types ¶
type DlOptions ¶
type DlOptions interface { GetConfigs() *configs.Config GetSessionCookies() []*http.Cookie GetAutoSolveCaptcha() bool GetNotifier() notify.Notifier GetCaptchaHandler() constants.CAPTCHA_FN GetContext() context.Context // Prog bars GetCaptchaSolverProgBar() progress.Progress SetAutoSolveCaptcha(bool) }