blob: 397d39726a9b6a8a5f33e79b9bbf2e1baecfb7dc (
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 serde::Deserialize;
const SHIGGY: &str = "https://safebooru.donmai.us";
const RANDOM: &str = "/posts/random.json?tags=kemomimi-chan_(naga_u)+naga_u&only=file_url";
#[derive(Deserialize)]
struct SafebooruResponse {
file_url: String,
}
pub async fn random<T>(http: &T) -> Result<String>
where
T: super::Ext,
{
let url = format!("{SHIGGY}{RANDOM}");
let resp: SafebooruResponse = http.get_json(&url).await?;
Ok(resp.file_url)
}
|