common

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TorrentURL = map[string]string{
		"ttobogo":       "https://ttobogo.net",
		"torrentmobile": "https://torrentmobile19.com",
		"torrentview":   "https://torrentview39.com",
		"tshare":        "https://tshare.org",
		"nyaa":          "https://nyaa.si",
		"sukebe":        "https://sukebei.nyaa.si",
		"torrentsir":    "https://torrentsir50.com",
		"torrentj":      "https://torrentj54.com",
		"torrentsee":    "https://torrentsee81.com",
		"jujutorrent":   "https://torrentjuju.com",
		"torrenttoast":  "https://tttt10.net",
		"torrentqq":     "https://torrentqq133.com",
		"torrentwiz":    "https://torrentwiz27.me",
		"torrentgram":   "https://torrentgram29.com",
		"torrentsome":   "https://torrentsome24.com",
		"ktxtorrent":    "https://ktxtorrent37.com",
		"torrentrj":     "https://torrentrj35.com",
	}
	UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36"
)

variable for scraping

Functions

func CheckNetWorkFromURL

func CheckNetWorkFromURL(url string) bool

CheckNetWorkFromURL function checks network status

func CollectData

func CollectData(s []Scraping, keyword string) map[string]string

CollectData function executes web scraping based on each scrapper

func CollectDataEx added in v0.3.0

func CollectDataEx(s []ScrapingEx, keyword string) map[string][]string

CollectDataEx function executes web scraping based on each scrapper

func GetResponseFromURL

func GetResponseFromURL(url string) (resp *http.Response, ok bool)

GetResponseFromURL returns *http.Response from url

func PrintData

func PrintData(data map[string]string)

PrintData function prints scraped data to console

func PrintDataEx added in v0.3.0

func PrintDataEx(data map[string][]string)

PrintDataEx function prints scraped data to console

func RemoveNonAscII added in v0.3.0

func RemoveNonAscII(s string) string

RemoveNonAscII remove non-ASCII characters

func URLJoin

func URLJoin(baseURL string, relURL string) string

URLJoin function join baseURL and relURL

Types

type Scraping

type Scraping interface {
	Crawl(string) map[string]string
}

Scraping interface is for web scraping

func GetAvailableSites

func GetAvailableSites(oldItems []Scraping) []Scraping

GetAvailableSites function gets available torrent sites

type ScrapingEx added in v0.3.0

type ScrapingEx interface {
	Crawl(string) map[string][]string
}

ScrapingEx interface is for web scraping

func GetAvailableSitesEx added in v0.3.0

func GetAvailableSitesEx(oldItems []ScrapingEx) []ScrapingEx

GetAvailableSitesEx function gets available torrent sites

Jump to

Keyboard shortcuts

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