38 lines
1.3 KiB
Rust
38 lines
1.3 KiB
Rust
//! Read-only native smoke: cargo run --locked --example anilist_probe
|
|
use std::io;
|
|
use tubular::{
|
|
anilist::{Client, catalog_count},
|
|
anime::Identity,
|
|
};
|
|
|
|
fn main() -> io::Result<()> {
|
|
let client = Client::default();
|
|
let results = client.search("Cowboy Bebop")?;
|
|
let media = results
|
|
.iter()
|
|
.find(|media| media["id"] == "1")
|
|
.ok_or_else(|| io::Error::other("Exact Cowboy Bebop AniList ID 1 absent from search"))?;
|
|
let id = media["id"]
|
|
.as_str()
|
|
.ok_or_else(|| io::Error::other("Missing catalog ID"))?;
|
|
let detail = client.detail(id)?;
|
|
let count = catalog_count(&detail)?.ok_or_else(|| io::Error::other("Catalog count unknown"))?;
|
|
if count == 0 {
|
|
return Err(io::Error::other("No catalog episode number 1"));
|
|
}
|
|
let identity = Identity::anilist(id.into(), 1)?;
|
|
println!(
|
|
"native search: {} records; exact AniList ID {id}",
|
|
results.len()
|
|
);
|
|
println!(
|
|
"detail: {count} catalog episode numbers; selected episode 1; provider availability UNVERIFIED"
|
|
);
|
|
println!("identity: {}", identity.key());
|
|
println!("watch URL: {}", identity.watch_url()?);
|
|
println!(
|
|
"PASS: native AniList search -> exact detail -> UNVERIFIED catalog episode -> stable sub URL (no playback request)"
|
|
);
|
|
Ok(())
|
|
}
|