use scraper::{Html, Selector};
#[tokio::main]
pub async fn xchangeit(amount: Option<&str>, from: Option<&str>, to: Option<&str>) -> Result<(), Box<dyn std::error::Error>> {
let url_final = format!("https://www.xe.com/currencyconverter/convert/?Amount={:?}&From={:?}&To={:?}", amount.unwrap_or_default(), from.unwrap_or_default(), to.unwrap_or_default());
let url = url_final.replace("\"", "");
let req = reqwest::get(url).await?;
let fragment = Html::parse_fragment(&req.text().await?);
let selector = Selector::parse(".iGrAod").unwrap();
for elem in fragment.select(&selector) {
println!("{}", elem.text().collect::<String>().trim());
}
Ok(())
}