v2ex/
v2ex.rs

1use llmweb::LlmWeb;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct VXNA {
6    pub username: String,
7
8    pub avatar_url: String,
9
10    pub profile_url: String,
11
12    pub title: String,
13
14    pub topic_url: String,
15
16    pub topic_id: u64,
17
18    pub relative_time: String,
19
20    pub reply_count: u32,
21
22    pub last_replier: Option<String>,
23}
24
25#[tokio::main]
26async fn main() {
27    let schema_str = include_str!("../schemas/v2ex_schema.json");
28
29    let llmweb = LlmWeb::new("gemini-2.0-flash");
30    let structed_value: Vec<VXNA> = llmweb
31        .exec_from_schema_str("https://v2ex.com/go/vxna", schema_str)
32        .await
33        .unwrap();
34    println!("{:#?}", structed_value);
35}