1 unstable release
0.1.0 | Oct 8, 2023 |
---|
20KB
384 lines
Pirate Bay Client
This is a minimal wrapper for The Pirate Bay. It provides functions to search for and fetch metadata on torrents. It is not a torrenting client: it only provides metadata. At present it does not support uploading torrents or managing user accounts either.
See the docs for more information including example usage.
Development
The data in src/scraped.rs
is generated by scraper.py
, which can be run as follows:
$ python3 scraper.py -c > src/scraped.rs
lib.rs
:
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);
Dependencies
~5–18MB
~243K SLoC