ygg

package
v0.0.0-...-2413221 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

README

Description of the Ygg Torrent scraping library

ygg searches torrents on yggtorrent

See here the Go documentation of this library.

Torrents can be searched freely on Ygg Torrent, but an account is needed to download the torrent file. This library authenticates the user before downloading the torrent file.

The Lookup function searches yggtorrent and returns a clean list of torrents. For each torrent the following info is retrieved:

  • name
  • description page
  • size
  • upload date
  • number of seeders
  • number of leechers

The FindAndDlFile function takes the Ygg Torrent user id and password, authenticates the user, opens a torrent description page, retrieves the torrent file url, and downloads the torrent file.

Documentation

Overview

Package ygg searches and downloads torrents from Ygg Torrent

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(). Input is a search string. Output is a slice of maps made up of the following keys:

- DescURL: the torrent description page

- 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)

Magnet file extraction are achieved by ExtractMag(). Input is the url of the torrent page. Output is the magnet link.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindAndDlFile

func FindAndDlFile(descURL string, in string, userID string, userPass string,
	timeout time.Duration, client *http.Client) (string, error)

FindAndDlFile authenticates user, opens the torrent description page, and downloads the torrent file. Returns the local path of downloaded torrent file. A user timeout is set.

Types

type Torrent

type Torrent struct {
	DescURL 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, *http.Client, error)

Lookup takes a user search as a parameter, launches the http request with a custom timeout, and returns clean torrent information fetched from Ygg Torrent.

Jump to

Keyboard shortcuts

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