public

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Sites = []*PublicBittorrentSite{
		{
			Name:    "nyaa",
			Domains: []string{"sukebei.nyaa.si", "nyaa.si"},

			TrackerDomains:          []string{"sukebei.tracker.wf", "nyaa.tracker.wf"},
			TorrentUrlIdRegexp:      regexp.MustCompile(`\bview/(?P<id>\d+)\b`),
			TorrentDownloadUrl:      `{{origin}}/download/{{id}}.torrent`,
			TorrentDownloadInterval: 5000,
		},
	}
	// site name & domain (main or tracker) => site
	SitesMap = map[string]*PublicBittorrentSite{}
)

Functions

This section is empty.

Types

type PublicBittorrentSite

type PublicBittorrentSite struct {
	Name                    string
	Domains                 []string // first one of Domains is considered as primary domain
	TrackerDomains          []string
	TorrentDownloadUrl      string         // placeholders: {{origin}}, {{domain}}, {{id}}
	TorrentUrlIdRegexp      *regexp.Regexp // extract torrent id (in "id" subgroup) from url
	TorrentDownloadInterval int64          // min interval between downloading 2 torrents (miliseconds)
}

func GetSiteByDomain

func GetSiteByDomain(defaultSite string, extraDomainOrUrls ...string) *PublicBittorrentSite

Get a public site by a website or tracker url or domain. defaultSite is a site name or domain. If none of extraDomainOrUrls matches with a existing site, use defaultSite as fallback.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳