1 个不稳定版本
0.1.0 | 2023 年 10 月 8 日 |
---|
#22 在 #category
20KB
384 行
海盗湾客户端
这是一个对海盗湾的最小封装。它提供了搜索和检索种子文件元数据的函数。它不是一个种子文件客户端:它只提供元数据。目前它也不支持上传种子文件或管理用户账户。
请参阅 文档 了解更多信息,包括示例用法。
开发
src/scraped.rs
中的数据由 scraper.py
生成,可以按以下方式运行
$ python3 scraper.py -c > src/scraped.rs
lib.rs
:
一个用于从海盗湾 API 获取数据的库。
这个库不旨在成为功能齐全的客户端,但如果您觉得缺少某些功能,欢迎贡献力量。这个库不是种子文件客户端,它只提供种子文件的元数据。
此客户端使用 JSON API,因此目前不能与大多数镜像一起使用。
示例
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);
依赖项
~4–20MB
~264K SLoC