Documentation ¶
Overview ¶
Package tpb searches and extracts magnet link from ThePirateBay
No check is done here regarding the user input. This check should be achieved by the caller. Parsing is achieved thanks to the GoQuery library. Comments common to all scraping libs are already done in the arc package which is very similar to this package. Only additional comments specific to this lib are present here.
Torrent search is achieved by Lookup(). All useful information is located in the search result page. No need to open a second page. Input is a search string. Output is a slice of maps made up of the following keys:
- Magnet: the torrent magnet
- Name: the torrent name
- Size: the size of the file to be downloaded
- UplDate: the date of upload
- Leechers: the number of leechers (set to -1 if cannot be converted to integer)
- Seechers: the number of seechers (set to -1 if cannot be converted to integer)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Torrent ¶
type Torrent struct { Magnet string Name string Size string UplDate string // Seeders and Leechers are converted to -1 if cannot be converted to integers Seeders int Leechers int }
Torrent contains meta information about the torrent
func Lookup ¶
Lookup takes a user search as a parameter and returns clean torrent information fetched from ThePirateBay. It first looks for the ThePirateBay proxies and then concurrently fetches all of them and retrieve results from the quickest one after checking that the latter is not broken. A custom user timeout is set.