25 releases (stable)

1.7.0 Sep 25, 2024
1.6.5 Sep 22, 2024
1.4.2 Aug 10, 2022
1.3.1 Aug 22, 2021
0.1.1 Aug 19, 2021

#1506 in Web programming

Download history 5/week @ 2024-07-29 712/week @ 2024-09-16 928/week @ 2024-09-23 133/week @ 2024-09-30 14/week @ 2024-10-07 32/week @ 2024-10-14

196 downloads per month
Used in lolicon

MIT license

19KB
464 lines

lolicon_api

Lolicon API 的 Rust 包装(仅仅提供请求URL构造)。

用例

Request 可以转换为一个URL (String) , 你应该使用 GET 方法。


lib.rs:

Lolicon API wrapper.

Example usage:

use lolicon_api::Request;
use lolicon_api::Category;
use lolicon_api::ImageSize;

let req = Request::default()
    .category(Category::R18) // R-18
    .num(1).unwrap() // 一张
    .uid(&[16731]).unwrap() // 玉之けだま老师
    .exclude_ai(true) // 排除AI图
    .aspect_ratio("lt1").unwrap() // 竖图
    .size(&[ImageSize::Original]).unwrap(); // 原图(默认行为)

let req_url = String::from(req);

assert_eq!(&req_url, "https://api.lolicon.app/setu/v2?&r18=1&uid=16731&excludeAI=true&aspectRatio=lt1");

Note: req_url's params are sorted by name, and only nessacary ones(i.e. not defaults) will be passed.

Dependencies

~0.3–1.4MB
~28K SLoC