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 RemoveDuplicateIdAndPageNum[T SliceTypes](idSlice, pageSlice []T) ([]T, []T)
- func RemoveSliceDuplicates[T SliceTypes](s []T) []T
- func SetChromedpAllocCookies(cookies []*http.Cookie) chromedp.Action
- func SliceContains[T SliceTypes](arr []T, target T) bool
- func SliceMatchesRegex(regex *regexp.Regexp, slice []string, strict bool) (bool, string)
- func ValidateDlDirPath(dlDirPath, targetDirName string) (validatedDirPath string, err error)
- func ValidateId(arg string) error
- func ValidateIds(args []string) error
- func ValidatePageNumInput(baseSliceLen int, pageNums []string, errMsgs []string) error
- 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)
- func VerifyCookies(website, userAgent string, cookies []*http.Cookie) error
- 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 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 ¶
func SliceContains[T SliceTypes](arr []T, target T) bool
Checks if the given target is in the given arr and returns a boolean
func SliceMatchesRegex ¶
Checks if the slice of string all matches the given regex pattern If strict is true, then all string must match the regex pattern. Otherwise, empty strings are allowed.
Returns true if all matches, false otherwise with the outlier string
func ValidateDlDirPath ¶ added in v1.1.0
func ValidateId ¶ added in v1.1.0
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
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
func VerifyCookie ¶
Verifies the given cookie by making a request to the website and returns true if the cookie is valid