36 releases (stable)

new 1.0.25 Aug 10, 2022
1.0.22 Jul 24, 2022
1.0.5 Mar 14, 2022
1.0.0 Feb 17, 2021
0.5.1 Jul 24, 2020

#73 in Web programming

Download history 95/week @ 2022-04-24 162/week @ 2022-05-01 149/week @ 2022-05-08 381/week @ 2022-05-15 114/week @ 2022-05-22 198/week @ 2022-05-29 173/week @ 2022-06-05 62/week @ 2022-06-12 42/week @ 2022-06-19 35/week @ 2022-06-26 58/week @ 2022-07-03 66/week @ 2022-07-10 81/week @ 2022-07-17 121/week @ 2022-07-24 75/week @ 2022-07-31 50/week @ 2022-08-07

331 downloads per month

MIT license

36KB
645 lines

RARBG TorrentAPI

A Rust wrapper for RARBG TorrentAPI
Report bug · Request feature

GitHub Workflow Status Crates.io Crates.io GitHub

Description

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.

Quick start

Add this to your Cargo.toml:

[dependencies]
rarbg_api = "1.0.25"
tokio = { version = "1.20.0", features = ["full"] }

Examples

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(&parameters)).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(&parameters)).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

Documentation is available here.

Bugs and feature requests

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.

Contributing

Contributions are welcome!

Contributors

Disclaimer

Downloading content that you (don't) have might be illegal in your country.

This is an unofficial rust package.

Dependencies

~7–15MB
~304K SLoC