Crate rbay

Source
Expand description

A library for fetching data from The Pirate Bay’s API.

This library does not aim to be a fully featured client, but contributions are welcome if you feel something is missing. This is not a torrent client, it only provides metadata on torrents.

This client uses the JSON API and as such currently won’t work with most mirrors.

§Example

use rbay::{Category, search, torrent};

// Get a category by ID to search within that category.
let movies = Category::new(201).unwrap();
assert_eq!(movies.name(), "Video: Movies");

// Search for torrents by name match and category.
let torrents = search("Barbie", Some(movies)).await?;
println!("Found {} torrents", torrents.len());

// Search returns most attributes of a torrent.
let first = &torrents[0];
println!("First torrent: {}", first.name);
println!("Magnet link: {}", first.magnet());

// And the missing ones can be fetched by torrent ID.
let torrent = torrent(first.id).await?;
println!("Description: {}", torrent.descr);

Structs§

Category
A media category code.
PartialTorrent
A torrent with only the details returned by listing endpoints.
Torrent
Full details on a torrent.
TorrentFile
Metadata on a file in a torrent.

Enums§

UserStatus
The trust status of an uploader.

Constants§

CATEGORIES
Category codes and associated names.
TRACKERS
Trackers used in magnet links on thepiratebay.org.

Functions§

search
Search for torrents by name match and optionally category.
top100
Get the top 100 torrents by category.
torrent
Get full metadata on a torrent by ID.
torrent_files
Get a list of file metadata for a torrent by ID.