Documentation ¶
Index ¶
- Constants
- func NewSite(name string, siteConfig *config.SiteConfigStruct, config *config.ConfigStruct) (site.Site, error)
- type Site
- func (npclient *Site) DownloadTorrent(torrentUrl string) (content []byte, filename string, id string, err error)
- func (npclient *Site) DownloadTorrentById(id string) ([]byte, string, error)
- func (npclient *Site) GetAllTorrents(sort string, desc bool, pageMarker string, baseUrl string) (torrents []*site.Torrent, nextPageMarker string, err error)
- func (npclient *Site) GetDefaultHttpHeaders() [][]string
- func (npclient *Site) GetLatestTorrents(full bool) ([]*site.Torrent, error)
- func (npclient *Site) GetName() string
- func (npclient *Site) GetSiteConfig() *config.SiteConfigStruct
- func (npclient *Site) GetStatus() (*site.Status, error)
- func (npclient *Site) PublishTorrent(contents []byte, metadata url.Values) (id string, err error)
- func (npclient *Site) PurgeCache()
- func (npclient *Site) SearchTorrents(keyword string, baseUrl string) ([]*site.Torrent, error)
- type TorrentsParserOption
Constants ¶
View Source
const ( SELECTOR_TORRENT = `a[href^="download.php?"],a[href^="download?"]` SELECTOR_DOWNLOAD_LINK = `a[href^="download.php?"],a[href^="download?"]` SELECTOR_DETAILS_LINK = `a[href^="details.php?"],a[href^="details_"]` SELECTOR_TORRENTS_LIST_DEFAULT = `table.torrents > tbody` // xiaomlove/nexusphp paid torrent feature. // see https://github.com/xiaomlove/nexusphp/blob/php8/app/Repositories/TorrentRepository.php . // function getPaidIcon. SELECTOR_TORRENT_PAID = `span[title="收费种子"],span[title="收費種子"],span[title="Paid torrent"]` // skip NP download notice. see https://github.com/xiaomlove/nexusphp/blob/php8/public/download.php LETDOWN_QUERYSTRING = "letdown=1" )
View Source
const (
DEFAULT_TORRENTS_URL = "torrents.php"
)
Variables ¶
This section is empty.
Functions ¶
func NewSite ¶
func NewSite(name string, siteConfig *config.SiteConfigStruct, config *config.ConfigStruct) (site.Site, error)
Types ¶
type Site ¶
type Site struct { Name string Location *time.Location SiteConfig *config.SiteConfigStruct Config *config.ConfigStruct HttpClient *azuretls.Session HttpHeaders [][]string // contains filtered or unexported fields }
func (*Site) DownloadTorrent ¶
func (npclient *Site) DownloadTorrent(torrentUrl string) (content []byte, filename string, id string, err error)
If torrentUrl is (seems) a torrent download url, direct use it. Otherwise try to parse torrent id from it and download torrent from id
func (*Site) DownloadTorrentById ¶
func (*Site) GetAllTorrents ¶
func (*Site) GetDefaultHttpHeaders ¶ added in v0.1.9
func (*Site) GetLatestTorrents ¶
func (*Site) GetSiteConfig ¶
func (npclient *Site) GetSiteConfig() *config.SiteConfigStruct
func (*Site) PublishTorrent ¶ added in v0.1.10
Upload torrent to nexusphp site. See: https://github.com/xiaomlove/nexusphp/blob/php8/public/takeupload.php . Upload: POST /takeupload.php with multipart/form-data
func (*Site) PurgeCache ¶
func (npclient *Site) PurgeCache()
type TorrentsParserOption ¶
type TorrentsParserOption struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.