Documentation
¶
Overview ¶
Package torznab implements Torznab/Newznab XML protocol types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPubDate ¶
FormatPubDate formats a time string for Torznab pubDate field (RFC1123Z). Handles RFC3339 dates, relative dates ("3 days", "1 week, 2 days"), and "now".
Types ¶
type Caps ¶
type Caps struct {
XMLName xml.Name `xml:"caps"`
Server CapsServer `xml:"server"`
Limits CapsLimits `xml:"limits"`
Searching CapsSearching `xml:"searching"`
Categories CapsCategories `xml:"categories"`
}
Caps is the XML capabilities document.
type CapsCategories ¶
type CapsCategories struct {
Categories []CapsCategory `xml:"category"`
}
type CapsCategory ¶
type CapsCategory struct {
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Subcats []CapsCategory `xml:"subcat,omitempty"`
}
type CapsLimits ¶
type CapsSearchType ¶
type CapsSearching ¶
type CapsSearching struct {
Search *CapsSearchType `xml:"search,omitempty"`
TVSearch *CapsSearchType `xml:"tv-search,omitempty"`
MovieSearch *CapsSearchType `xml:"movie-search,omitempty"`
}
type CapsServer ¶
type CapsServer struct {
Title string `xml:"title,attr"`
}
type Feed ¶
type Feed struct {
XMLName xml.Name `xml:"rss"`
Version string `xml:"version,attr"`
AtomNS string `xml:"xmlns:atom,attr,omitempty"`
TorznabNS string `xml:"xmlns:torznab,attr"`
Channel Channel `xml:"channel"`
}
Feed is the Torznab RSS search results feed.
type Item ¶
type Item struct {
Title string
GUID string
Link string // detail page URL
PubDate string
Size int64
Enclosure *Enclosure
Attrs map[string]string // torznab attributes (seeders, peers, etc.)
}
Item is a single search result. Custom XML marshaling is used to produce <torznab:attr> elements in the correct namespace.
func ResultToItem ¶
ResultToItem converts a scraper SearchResult to a Torznab Item.
func SearchResultToItem ¶
func SearchResultToItem(title, guid, link, pubDate string, size int64, downloadURL string, seeders, leechers int, dvf, uvf float64, category string) Item
SearchResultToItem converts a scraper.SearchResult to a torznab.Item.
func (Item) MarshalXML ¶
MarshalXML produces the Torznab-compatible XML for an Item.
Click to show internal directories.
Click to hide internal directories.