use bridge_updater_lib::updater::Updater; use std::{io::Write, fs::OpenOptions}; #[tokio::main] async fn main() { if let Ok(mut upd) = Updater::new() { /* Retrieve captcha */ if upd.retrieve_captcha().await.is_ok() { if let Some((_captcha_id, captcha_image)) = upd.captcha.clone() { let mut captcha_file = OpenOptions::new().write(true).create(true).truncate(true).open("captcha_image.jpg").unwrap(); captcha_file.write_all(&captcha_image).unwrap(); captcha_file.sync_all().unwrap(); } } /* Retrieve bridges */ let input_captcha = "ekGbudf"; if upd.retrieve_bridges(&input_captcha).await.is_ok() { if let Some((bridges_text, bridges_qr)) = upd.bridges.clone() { println!("Bridges: {}", bridges_text); let mut qrcode_file = OpenOptions::new().write(true).create(true).truncate(true).open("bridges_qrcode.jpg").unwrap(); qrcode_file.write_all(&bridges_qr).unwrap(); qrcode_file.sync_all().unwrap(); } } } }