tpb

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: GPL-3.0 Imports: 9 Imported by: 1

README

Description of the ThePirateBay scraping library

tpb searches torrents on all The Pirate Bay proxies located on https://proxybay.bz

See here the Go documentation of this library.

The Lookup function retrieves all The Pirate Bay urls located on https://proxybay.bz, launches a search on all thoses urls concurrently, and returns a clean list of torrents from the url that responded first. The returned url is also checked in-depth because some proxies sometimes return a page with no error but the page actually does not have any result. For each torrent the following info is retrieved:

  • name
  • magnet link
  • size
  • upload date
  • number of seeders
  • number of leechers

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

func Lookup(in string, timeout time.Duration) ([]Torrent, error)

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.

Jump to

Keyboard shortcuts

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