6 releases (breaking)

0.5.1 Nov 28, 2022
0.5.0 Nov 28, 2022
0.4.0 Nov 4, 2022
0.3.0 Sep 18, 2022
0.1.0 Jan 17, 2022

#793 in Images

MIT license

25KB
619 lines

pixivcrab

A pixiv AppAPI in Rust.

Example

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);
        }
    }
}

lib.rs:

A pixiv AppAPI in Rust.

Example

use pixivcrab::{AppApi, AppApiConfig, AuthMethod};
use reqwest::ClientBuilder;
use std::env::var;

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);
        }
    }
}

Dependencies

~5–18MB
~270K SLoC