A Rust wrapper for RARBG TorrentAPI
Report bug
·
Request feature
This Rust module allows easy interaction with RARBG TorrentAPI.
In particular, it allows you to list or search torrents and to export them to a magnet file.
Add this to your Cargo.toml
:
[dependencies]
rarbg_api = "1.0.43-rc.1"
tokio = { version = "1.28.1", features = ["full"] }
extern crate rarbg_api;
use rarbg_api::api_parameters_builder::ApiParametersBuilder;
use rarbg_api::category::Category;
use rarbg_api::limit::Limit;
use rarbg_api::RarBgApi;
use rarbg_api::sort_by::SortBy;
#[tokio::main]
pub async fn main() {
let mut api = RarBgApi::new("my_app_id").await;
let parameters = ApiParametersBuilder::new()
.limit(Limit::TwentyFive)
.categories(vec![Category::TvUhdEpisodes, Category::TvHdEpisodes, Category::TvEpisodes])
.sort_by(SortBy::Seeders)
.build();
let result = api.list(Some(¶meters)).await;
match result {
// Export all torrents found in the current directory.
// Each file contains a magnet link that can be add in your Bittorrent client.
Ok(result) => result.torrents().iter().for_each(|t| println!("Torrent exported to '{}'.", t.export(".").unwrap())),
Err(reason) => println!("{}", reason.error())
}
}
extern crate rarbg_api;
use rarbg_api::api_parameters_builder::ApiParametersBuilder;
use rarbg_api::category::Category;
use rarbg_api::limit::Limit;
use rarbg_api::RarBgApi;
use rarbg_api::sort_by::SortBy;
#[tokio::main]
pub async fn main() {
let mut api = RarBgApi::new("my_app_id").await;
let parameters = ApiParametersBuilder::new()
.limit(Limit::TwentyFive)
.categories(vec![Category::TvUhdEpisodes, Category::TvHdEpisodes, Category::TvEpisodes])
.sort_by(SortBy::Seeders)
.build();
let result = api.search("Rick and Morty", Some(¶meters)).await;
match result {
// Export first torrent found in the current directory.
// The file contains a magnet link that can be add in your Bittorrent client.
Ok(result) => result.torrents().iter().take(1).for_each(|t| println!("Torrent exported to '{}'.", t.export(".").unwrap())),
Err(reason) => println!("{}", reason.error())
}
}
Documentation is available here.
Have a bug or a feature request? Please first search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.
Contributions are welcome!
- Orestis for his feedback
Downloading content that you (don't) have might be illegal in your country.
This is an unofficial rust package.
RARBG has been shutdown by the administrators.
Hello guys,
We would like to inform you that we have decided to shut down our site.
The past 2 years have been very difficult for us - some of the people in our team died due to covid complications,
others still suffer the side effects of it - not being able to work at all.
Some are also fighting the war in Europe - ON BOTH SIDES.
Also, the power price increase in data centers in Europe hit us pretty hard.
Inflation makes our daily expenses impossible to bare.
Therefore we can no longer run this site without massive expenses that we can no longer cover out of pocket.
After an unanimous vote we've decided that we can no longer do it.
We are sorry :(
Bye