sites

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListSites

func ListSites() []string

ListSites returns the names of all registered site handlers.

func NewItchio

func NewItchio(apiKey string)

NewItchio registers the itch.io handler. An empty apiKey is fine — Resolve will just tell the user to set one up.

func Register

func Register(s Site)

Register adds a site handler to the global registry.

Types

type FlashpointClient

type FlashpointClient struct {
	// contains filtered or unexported fields
}

FlashpointClient looks up games in the Flashpoint Archive database.

func NewFlashpointClient

func NewFlashpointClient() *FlashpointClient

func (*FlashpointClient) Lookup

func (fp *FlashpointClient) Lookup(title, sourceURL string) *FlashpointMatch

Lookup searches Flashpoint for a game by title and source URL, returning the best match or nil if nothing matched well enough.

type FlashpointMatch

type FlashpointMatch struct {
	ID        string
	Title     string
	Developer string
	Source    string // original page URL
	Platform  string
}

FlashpointMatch holds metadata from a confirmed Flashpoint Archive entry.

type Game

type Game struct {
	Title      string
	Source     string           // human-readable site name
	URL        string           // the original URL provided by the user
	Files      []GameFile       // at least one entry
	Flashpoint *FlashpointMatch // nil if no Flashpoint match found
}

Game holds metadata about a discovered game and its downloadable files.

func Resolve

func Resolve(rawURL string) (*Game, error)

Resolve routes a URL to the appropriate site handler, resolves the game, and returns the result. Returns an error if no site matches.

type GameFile

type GameFile struct {
	Name     string // display name (e.g. "Game.swf" or "Windows build")
	URL      string // direct download URL
	Size     int64  // content length in bytes, 0 if unknown
	Filename string // suggested filename on disk
}

GameFile represents a single downloadable file for a game.

type Site

type Site interface {
	// Name returns a short human-readable label like "Newgrounds".
	Name() string

	// Match reports whether the given URL belongs to this site.
	Match(u *url.URL) bool

	// Resolve fetches game metadata and download links for the given URL.
	Resolve(rawURL string) (*Game, error)
}

Site knows how to detect and resolve game downloads from a particular host.

Jump to

Keyboard shortcuts

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