| Crates.io | shindan-maker |
| lib.rs | shindan-maker |
| version | 0.1.30 |
| created_at | 2024-10-12 10:35:54.583063+00 |
| updated_at | 2026-01-18 06:46:03.520304+00 |
| description | A Rust library for interacting with ShindanMaker, the popular personality quiz service. |
| homepage | |
| repository | https://github.com/araea/shindan-maker |
| max_upload_size | |
| id | 1406426 |
| size | 1,863,129 |
A Rust library for interacting with ShindanMaker, the popular personality quiz service.
[dependencies]
# default feature: ["segments"]
# optional features: ["html"], ["full"] (segments + html)
shindan-maker = { version = "0.1", features = ["segments"] }
use anyhow::Result;
use shindan_maker::{ShindanClient, ShindanDomain};
#[tokio::main]
async fn main() -> Result<()> {
let client = ShindanClient::new(ShindanDomain::En)?; // Enum variant
// let client = ShindanClient::new("Jp".parse()?)?; // String slice
// let client = ShindanClient::new("EN".parse()?)?; // Case-insensitive
// let client = ShindanClient::new(String::from("cn").parse()?)?; // String
let title = client
.get_title("1222992")
.await?;
assert_eq!("Fantasy Stats", title);
Ok(())
}
use shindan_maker::{ShindanClient, ShindanDomain};
#[tokio::main]
async fn main() {
let client = ShindanClient::new(ShindanDomain::En).unwrap();
let (segments, title) = client
.get_segments_with_title("1222992", "test_user")
.await
.unwrap();
assert_eq!("Fantasy Stats", title);
println!("Result title: {}", title);
println!("Result text: {}", segments);
println!("Result segments: {:#?}", segments);
}
To convert the HTML string to an image, consider using cdp-html-shot.
#[tokio::main]
async fn main() {
#[cfg(feature = "html")]
{
use shindan_maker::{ShindanClient, ShindanDomain};
let client = ShindanClient::new(ShindanDomain::En).unwrap();
let (_html_str, title) = client
.get_html_str_with_title("1222992", "test_user")
.await
.unwrap();
assert_eq!("Fantasy Stats", title);
}
}