https://github.com/niuhuan/pica-rust
Rust哔卡漫画API
https://github.com/niuhuan/pica-rust
acg bika cosplay pica picacg picacomic picacomic-api r-18 rust
Last synced: 5 months ago
JSON representation
Rust哔卡漫画API
- Host: GitHub
- URL: https://github.com/niuhuan/pica-rust
- Owner: niuhuan
- License: mit
- Created: 2021-11-15T03:22:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2026-01-14T05:15:15.000Z (6 months ago)
- Last Synced: 2026-01-14T07:26:24.249Z (6 months ago)
- Topics: acg, bika, cosplay, pica, picacg, picacomic, picacomic-api, r-18, rust
- Language: Rust
- Homepage:
- Size: 62.5 KB
- Stars: 42
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PICA-RUST
===========
Rust哔卡漫画API
## 实现功能
- [x] 用户
- [x] 注册 / 登录 / 获取用户信息 / 打卡
- [x] 修改签名 / 修改头像
- [x] 找回密码
- [x] 漫画
- [x] 分类 / 随机本子 / 获取章节 / 获取图片
- [x] 收藏漫画 / 喜欢漫画
- [x] 获取漫画评论 / 对漫画发表评论及回复
- [x] 我的评论 / 喜欢/取消喜欢评论 /
- [x] 搜索漫画 / 大家都在搜
- [x] 排行榜 / 骑士榜
- [x] 看了这个本子的也在看
- [x] 游戏列表 / 详情 / 评论相关
- [x] 网络
- [x] 获取官方分流
- [x] 代理 / 分流
## 使用方法
在Cargo.toml中增加依赖
```toml
[dependencies]
pica = { git = "https://github.com/niuhuan/pica-rust.git", branch = "master" }
```
基本使用
```rust
use pica::{Client, Sort};
#[tokio::main]
async fn main() -> Result<(), Box> {
// 创建客户端
let client = Client::new().await;
// 可选:设置代理或分流
client.set_proxy(None).await?;
client
.set_switch_addresses(vec!["172.67.80.1:443".to_string()])
.await?;
// 登录或直接注入 token
client.login("username", "password").await?;
// client.set_token("token").await;
// 获取漫画列表
let comics = client
.comics(None, None, None, None, None, Sort::SORT_DEFAULT, 1)
.await?;
println!("got {} comics", comics.docs.len());
Ok(())
}
```
链式 Builder 示例
```rust
// 与 comics 等效,但可链式配置后直接 .await
let page = client
.comics_builder()
.category("纯爱")
.sort(Sort::SORT_TIME_NEWEST)
.page(1)
.await?;
println!("docs: {}", page.docs.len());
```
在 [client.rs](src/client.rs) 中查看可用的分流列表
在 [test.rs](src/test.rs) 中的 download_first_comic_cover_and_page , 是从登录到下载的完整demo, 测试时需要设置环境变量