43个稳定版本

1.0.42 2023年5月11日
1.0.39 2023年2月6日
1.0.36 2022年12月11日
1.0.34 2022年11月19日
0.5.1 2020年7月24日

297Web编程

每月28次下载

MIT 许可证

37KB
645

RARBG TorrentAPI

RARBG TorrentAPI 的Rust包装器
报告错误 · 请求功能

GitHub Workflow Status Crates.io Crates.io GitHub

描述

此Rust模块允许轻松与RARBG TorrentAPI交互。

特别是,它允许您列出或搜索种子,并将它们导出为磁力链接文件。

快速开始

将此添加到您的 Cargo.toml

[dependencies]
rarbg_api = "1.0.42"
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(&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())
    }
}

文档

文档可在 此处 找到。

错误和功能请求

有错误或功能请求吗?请首先搜索现有和已关闭的问题。如果您的错误或想法尚未得到解决,请 创建新问题

贡献

欢迎贡献!

贡献者

免责声明

下载您(没有)拥有的内容可能在您的国家/地区是非法的。

这是一个非官方的Rust包。

依赖关系

~7–19MB
~292K SLoC