feat(scraping): friend page is now scrapped

This commit is contained in:
Maieul BOYER 2026-02-08 16:21:04 +01:00
parent c4ef2a129a
commit 73fe9b85a3
Signed by: maix
SSH key fingerprint: SHA256:iqCzqFFF5KjRixmDExqbAltCIj9ndlBWIGJf3t9Ln9g
3 changed files with 117 additions and 8 deletions

View file

@ -0,0 +1,27 @@
use froxy_scrapper::{state::State, types::ClusterLocation};
#[tokio::main(flavor = "current_thread")]
async fn main() {
let session = std::env::var("FROXY_COOKIE")
.expect("provide `FROXY_COOKIE` with the session cookie from you friends42 instance");
let state = State::new(session);
let res = state.get("/friends/", None).await.unwrap();
let text = res.text().await.unwrap();
let location = froxy_scrapper::parsing::friend_page(&text);
for l in &location.friends {
println!(
"{:^10} | {:^10} | {:^30} | {:^20}",
l.login,
l.position.as_ref().map(|s| s.as_str()).unwrap_or("<>"),
l.last_active.as_ref().map(|s| s.as_str()).unwrap_or("<>"),
l.image
.as_ref()
.map(|s| &s[s.len().saturating_sub(20)..])
.unwrap_or("<>")
);
}
}