Documentation ¶
Index ¶
- func ConvertDurationToSeconds(duration string, hms ...struct{}) int64
- func DecodeSessionData(data string, apply func(prop, value string)) bool
- func Deduplicate(values []string) []string
- func FormatDuration(duration int64) string
- func FormatNumber(num int) string
- func FormatPublished(published string) string
- func GetDataFromURL(uri string) url.Values
- func GetHostname(hostURL string) string
- func GetUnixTimeAfter(years int) int64
- func GetVPIDFromURL(uri string) (string, string, string, error)
- func IsValidJSON(text string) bool
- func IsValidURL(uri string) (*url.URL, error)
- func SanitizeCookie(cookie string) string
- func TrimPath(testPath string, cdBack bool) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertDurationToSeconds ¶ added in v0.3.6
ConvertDurationToSeconds converts a "hh:mm:ss" or a "01h01m01s" string to seconds. If only a number is provided, it will be converted to seconds.
func DecodeSessionData ¶ added in v0.3.7
DecodeSessionData decodes session data from a playlist item.
func Deduplicate ¶ added in v0.3.3
Deduplicate removes duplicate values from the slice.
func FormatDuration ¶
FormatDuration takes a duration as seconds and returns a hh:mm:ss string.
func FormatNumber ¶
FormatNumber takes a number and represents it in the billions(B), millions(M), or thousands(K) format, with one decimal place. If there is a zero after the decimal, it is removed.
func FormatPublished ¶
FormatPublished takes a duration in the format: "1 day ago", and returns it in the format: "1d".
func GetDataFromURL ¶
GetDataFromURL parses specific url fields and returns their values.
func GetHostname ¶
GetHostname gets the hostname of the given URL.
func GetUnixTimeAfter ¶
GetUnixTimeAfter returns the Unix time after the given number of years.
func GetVPIDFromURL ¶
GetVPIDFromURL gets the video/playlist ID from a URL.
func IsValidURL ¶
IsValidURL checks if a URL is valid.
func SanitizeCookie ¶
SanitizeCookie sanitizes and returns the provided cookie. This is used to avoid the logging present in the net/http package. https://cs.opensource.google/go/go/+/refs/tags/go1.20.5:src/net/http/cookie.go;l=428
Types ¶
This section is empty.