blob: d6a623808d3072a74771547b855bc4884b14ba2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use eyre::Result;
use log::debug;
use serde::Deserialize;
const SHIGGY: &str = "https://safebooru.donmai.us";
const RANDOM_SHIGGY: &str = "/posts/random.json?tags=kemomimi-chan_(naga_u)+naga_u&only=file_url";
#[derive(Deserialize)]
struct SafebooruResponse {
file_url: String,
}
#[allow(clippy::module_name_repetitions)]
pub async fn random_shiggy() -> Result<String> {
let url = format!("{SHIGGY}{RANDOM_SHIGGY}");
debug!("Making request to {url}");
let resp: SafebooruResponse = super::get_json(&url).await?;
Ok(resp.file_url)
}
|