bunkr

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package bunkr contains functions that can be used to accurately extract and validate Bunkr links.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(res string) string

Convert takes a bunkr link in string format as an argument and converts the domain to one that is currently active (bunkrr.su right now). Result returned in string format

func Delegate

func Delegate(res, source string) ([]models.Entry, error)

Delegate takes a string as an argument and returns a slice of valid Bunkr links found within the response (if any) or nil, and an error

func Extract

func Extract(res string) ([]string, error)

Extract returns a slice of all Bunkr links contained within a string, if any.

func ExtractFileCount

func ExtractFileCount(bunkrContents string) int

ExtractFileCount takes the body response/contents of a Bunkr 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

func ExtractSize(bunkrContents string) string

ExtractSize takes the body response/contents of a Bunkr page (raw source/html (formatted as string)) as an argument and returns the album's total/cumulative file size as a string.

func ExtractThumbnail

func ExtractThumbnail(bunkrContents string) string

ExtractThumbnail takes the body response/contents of a Bunkr page (raw source/html (formatted as string)) as an argument. Bunkr 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

func ExtractTitle(bunkrContents string) string

ExtractTitle takes the body response/contents of a Bunkr page (raw source/html (formatted as string)) as an argument and returns the album's title as a string.

func ExtractViewCount

func ExtractViewCount(albumUrl string) (int, error)

ExtractViewCount uses the Bunkr API (https://slut.bunkr.ru/slutsCount?pageUrl=${pageUrl}) to get view count. It takes a bunkr album link as an argument (in string format) and returns a string containing the view count, alongside an error. The error will be nil if everything is successful. If a failure occurs, -1 will be returned.

func Validate

func Validate(x string) (bool, error)

Validate performs a GET request to the Bunkr URL and uses the response status code to identify its validity If the link is valid, it will return true. If not, it will return false. Validate also returns an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL