12个版本
0.3.4 | 2024年7月25日 |
---|---|
0.3.3 | 2024年7月25日 |
0.3.0-alpha.1 | 2019年11月9日 |
0.2.1 | 2019年6月30日 |
0.1.4 | 2019年6月16日 |
#110 in 图像
454 每月下载量
在 2 crate 中使用
170KB
813 行
RustNAO
SauceNAO API的Rust库实现。
安装
将以下内容添加到您的 Cargo.toml
文件中
[dependencies]
rustnao = "0.3.4"
示例
这是一个简单的示例
use rustnao::{HandlerBuilder, Sauce};
fn main() {
let api_key = "your_api_key";
let file = "https://i.imgur.com/W42kkKS.jpg";
// Specifying our key, test_mode set to 0, only want to see Pixiv and Sankaku using a mask, nothing excluded, no one specific source, and 15 results at most
let handle = HandlerBuilder::default().api_key(api_key).db_mask([Handler::PIXIV, Handler::SANKAKU_CHANNEL].to_vec()).num_results(15).build();
// Set the minimum similarity to 45.
handle.set_min_similarity(45);
// Returns a vector of Sauce objects if successful
let result: Vec<Sauce> = handle.get_sauce(file, None, None).unwrap();
// Or perhaps you prefer a JSON output
let result_json: String = handle.get_sauce_as_pretty_json(file, None, None).unwrap();
// Or maybe you wish to only get 5 results with a min similarity of 50.0
let result_json_filtered: String = handle.get_sauce_as_pretty_json(file, Some(5), Some(50 as f64)).unwrap();
}
更多示例 在这里。
文档
更多文档可以在 这里 找到。您还可以查看SauceNAO的API文档 这里。
开发
有兴趣帮忙吗?发现了问题/错误?告诉我!
感谢/致谢
我受到了 Sagiri 的启发,所以我要为那个项目喊一声。此外,感谢 SauceNAO 提供这项免费的功能。
此外,感谢Pixiv用户 リン ☆ ユウ@1 日目 西れ 44b 为我提供的 这幅图像,我经常用它进行示例和测试。我似乎找不到用于本地测试的图像(SauceNAO让我失望了),如果有人知道,请告诉我,以便我可以给予他们应有的信用。
依赖关系
~10–22MB
~342K SLoC