workshop

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: Unlicense Imports: 16 Imported by: 0

Documentation

Overview

This package is mostly a rewrite of https://github.com/SegoCode/swd/blob/main/swd.go which was provided via GitHub under The Unlicence

Index

Constants

View Source
const ENDPOINT string = "https://node05.steamworkshopdownloader.io/prod//api/"

Variables

This section is empty.

Functions

func CheckAvailable

func CheckAvailable(resource any) (string, []error)

Checks if a resource is available.

Param `resource` is an int for its Workshop ID or a string for its Workshop URL.

func DownloadResource

func DownloadResource(id int, output io.Writer) error

Writes Workshop resource by ID to given Writer.

func ExtractResource

func ExtractResource(r resource.Resource, dir, game string, verbose bool) (string, error)

Extracts things that match "dir/id - (downloaded title).zip" where dir is a given directory and id is the given Workshop ID.

Deletes the archive if successful.

func GetBreadcrumbs added in v1.0.1

func GetBreadcrumbs(url string) ([]string, error)

At the top of a Workshop page theres "breadcrumbs" which look like "Game > Workshop > Collections > User's Workshop". This function looks for thos "breadcrumbs" then gives them like []string{ "Game", "Workshop", "Collections", "User's Workshop" }

func GetGame

func GetGame(id any) (string, error)

Gets the game from a steam workshop ID or URL. Arg "id" accepts int or string, where the former is the ID and the latter is the full URL.

func GetResourceTitle

func GetResourceTitle(url string) (string, error)

Gets the Workshop title from the page given.

func IsCollection

func IsCollection(url string) (bool, error)

Returns true if the given page is a URL.

At the top of a Workshop page theres "breadcrumbs" which look like "Game > Workshop > Collections > User's Workshop". This function checks if "Collection" is in those breadcrumbs.

func WorkshopIDFromURL deprecated

func WorkshopIDFromURL[T ~string](url T) (int, error)

Deprecated: use utils.WorkshopIDFromURL

Extracts the Workshop ID from its URL.

func WorkshopIDToURL deprecated

func WorkshopIDToURL[T constraints.Integer](id T) (string, bool)

Deprecated: use utils.WorkshopIDToURL

Converts a Workshop ID to a Workshop URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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