#search #si #nyaa #torrent #anime #async #rsearch

nyaa-rsearch

nyaa.si 上搜索种子文件的 Rust 库

6 个版本

0.1.5 2024年1月21日
0.1.4 2024年1月19日
0.1.3 2023年11月10日
0.1.0 2023年8月10日

#3 in #nyaa

MIT 许可证

21KB
393

Nyaa-rsearch


nyaa.si 上搜索种子文件的 Rust 库

使用方法


简单搜索

use std::error::Error; 
use nyaa_rsearch::{blocking ,models::categories, search}; // import required function

pub fn main() -> Result<(), Box<dyn Error>> {
    //create the SearchInput with the search information
    let input = SearchInput::new(
        "Houseki No Kuni".to_string(),
        1,
        categories::Categories::Anime,
    )?;
    //research
    let search_result = blocking::search(input).unwrap();
    //Display the result of the research
    println!("{}", search_result.info());

    Ok(())
}

结果

search -> Houseki No Kuni
category -> Anime
page -> 1
max page -> 3
------first torrent------
name -> [Cleo] Houseki no Kuni | Land of the Lustrous [Dual Audio 10bit BD1080p][HEVC-x265]
category -> AnimeEnglishTranslated
torrent download link -> https://nyaa.si/download/1546687.torrent
magnet link -> magnet:?xt=urn:btih:cd2ea8ede11332d2a1a6a4bc6058fc73cb3ffe08&dn=%5BCleo%5D%20Houseki%20no%20Kuni%20%7C%20Land%20of%20the%20Lustrous%20%5BDual%20Audio%2010bit%20BD1080p%5D%5BHEVC-x265%5D&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce
size -> 4.5 GiB
date (timestamp) -> 1656314786
nbrs of seeders -> 79
nbrs of leechers -> 3
nbrs of approved -> 2807

-------------------------
75 torrent found in total

异步版本

点击展开
use nyaa_rsearch::{r#async as func, models::categories, SearchInput};
use std::error::Error; // import required function
use tokio::macros;


#[tokio::main]
pub async fn main() -> Result<(), Box<dyn Error>> {
    //create the SearchInput with the search information
    let input = SearchInput::new(
        "Houseki No Kuni".to_string(),
        1,
        categories::Categories::Anime,
    )?;
    //research
    let mut search_result = func::search(input).await?;
    //Display the result of the research
    println!("{}", search_result.info());

    Ok(())
}

切换页面

use std::error::Error; 
use nyaa_rsearch::{blocking, models::categories, search}; // import required function

pub fn main() -> Result<(), Box<dyn Error>> {
    //create the SearchInput with the search information
    let input = SearchInput::new(
        "Houseki No Kuni".to_string(),
        1,
        categories::Categories::Anime,
    )?;
    //research
    let mut search_result = blocking::search(input).unwrap();
    search_result.blocking_next_page()?; // go to next page
    // search_result.previous_page()? // go to previous page
    println!("{}", search_result.info()); //Display the result of the research

    Ok(())
}

结果

search -> Houseki No Kuni
category -> Anime
page -> 2
max page -> 3
------first torrent------
name -> [Nekomoe kissaten] Houseki no Kuni - 11 [WebRip 1920x1080 HEVC-yuv420p10 EAC3]
category -> AnimeRaw
torrent download link -> https://nyaa.si/download/989254.torrent
magnet link -> magnet:?xt=urn:btih:49993ee15382d31a1edbb98d6257ea20144759cf&dn=%5BNekomoe%20kissaten%5D%20Houseki%20no%20Kuni%20-%2011%20%5BWebRip%201920x1080%20HEVC-yuv420p10%20EAC3%5D&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce
size -> 521.1 MiB
date (timestamp) -> 1513736489
nbrs of seeders -> 0
nbrs of leechers -> 0
nbrs of approved -> 220

-------------------------
75 torrent found in total

安装

要安装此库,只需执行以下操作

cargo add nyaa-rsearch

贡献

任何改进或问题都欢迎使用帮助此库提高其稳定性

依赖项

~8–21MB
~318K SLoC