Collect a lot more data.

This commit is contained in:
2019-01-17 15:02:50 +01:00
parent b60419f3d1
commit 31922bbc3f
5 changed files with 150 additions and 17 deletions

View File

@@ -11,6 +11,13 @@ struct Info {
message: String,
}
#[derive(Debug, FromHtml)]
#[html(selector = ".body-content > .row")]
struct Error {
#[html(selector = ".col-md-12", attr = "inner")]
message: String,
}
pub struct KonsumentInfo;
impl Probe for KonsumentInfo {
@@ -33,9 +40,11 @@ impl Probe for KonsumentInfo {
println!("konsumentinfo.se:");
if let Ok(info) = Info::from_html(&body) {
println!(" {}", info.message);
println!(" {}", info.message);
} else if let Ok(error) = Error::from_html(&body) {
println!(" {}", error.message);
} else {
println!(" Failed to find any data");
println!(" Failed to find any data");
}
Ok(())