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

Enums

Constants

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

Functions

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