Crates.io | pixivcrab |
lib.rs | pixivcrab |
version | 0.5.1 |
source | src |
created_at | 2022-01-17 06:56:17.1563 |
updated_at | 2022-11-28 05:49:33.43849 |
description | A pixiv AppAPI in Rust. |
homepage | |
repository | https://github.com/WOo0W/pixivcrab-rs |
max_upload_size | |
id | 515335 |
size | 26,297 |
A pixiv AppAPI in Rust.
use pixivcrab::{AppApi, AppApiConfig, AuthMethod};
use reqwest::ClientBuilder;
use std::env::var;
#[tokio::test]
async fn example() {
let mut config = AppApiConfig::default();
config.set_language("en-us").unwrap();
let api = AppApi::new_with_config(
AuthMethod::RefreshToken(var("PIXIV_REFRESH_TOKEN").unwrap()),
ClientBuilder::new(),
config,
)
.unwrap();
let user = api.user_detail("123456").await.unwrap();
println!("{:?}", user);
let mut pager = api.illust_bookmarks("123456", false);
while let Some(r) = pager.next().await.unwrap() {
for i in r.illusts {
println!("{} {:?}", i.title, i.tags);
}
}
}