Documentation ¶
Overview ¶
Package cyberdrop contains functions that can be used to accurately extract and validate Cyberdrop links.
Index ¶
- func Delegate(res, source string) ([]models.Entry, error)
- func Extract(res string) ([]string, error)
- func ExtractDescription(doodContents string, excludeDefault bool) string
- func ExtractFileCount(doodContents string) int
- func ExtractSize(doodContents string) string
- func ExtractThumbnail(doodContents string) string
- func ExtractTitle(doodContents string) string
- func ExtractUploadDate(doodContents string, dateFormat string) (string, error)
- func Validate(x string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delegate ¶
Delegate takes a string as an argument and returns a slice of valid Cyberdrop links found within the response (if any) or nil, and an error
func ExtractDescription ¶
ExtractDescription takes the body response/contents of a Cyberdrop page (raw source/html (formatted as string)) and the excludeDefault flag (bool). The exclude default flag will return an empty string in the case that the album creator did not specify a description, rather than Cyberdrop's ~150 character default description. This should be set to true in most cases. If the album creator did specify a description, it will be returned as a string.
func ExtractFileCount ¶
ExtractFileCount takes the body response/contents of a Cyberdrop page (raw source/html (formatted as string)) as an argument and returns the album's file count as an integer. It will return -1 in the case of a syntax error.
func ExtractSize ¶
ExtractSize takes the body response/contents of a Cyberdrop page (raw source/html (formatted as string)) as an argument and returns the album's total/cumulative file size as a string.
func ExtractThumbnail ¶
ExtractThumbnail takes the body response/contents of a Cyberdrop page (raw source/html (formatted as string)) as an argument. Cyberdrop albums do not have a dedicated thumbnail, so ExtractThumbnail() instead extracts the first image URL it finds, as this can grant more insight if other metadata is misleading/inconclusive. The extracted URL is unescaped to ensure validity and returned in string format.
func ExtractTitle ¶
ExtractTitle takes the body response/contents of a Cyberdrop page (raw source/html (formatted as string)) as an argument and returns the album's title as a string.
func ExtractUploadDate ¶
ExtractUploadDate takes the body response/contents of a Cyberdrop page (raw source/html (formatted as string)) as and a dateFormat string as it's arguments. The dateFormat string will be used to format a time.Time into a more favorable format. The default dateFormat used by tempest is "Jan 02, 2006". It will return a date in string format, which has been formatted in accordance with the specified dateFormat, and an error which will be nil if successful.
Types ¶
This section is empty.