Module fetch

Module fetch 

Source
Available on crate feature scraper only.
Expand description

Data fetching and HTML parsing helpers

Provides HTML parsing when the scraper feature is enabled, used to extract the header JSON URL from <meta name="bmstable" content="..."> in a page. Also provides a unified entry to parse a response string into the header JSON or its URL.

§Examples

let html = r#"
<!DOCTYPE html>
<html>
  <head>
    <meta name="bmstable" content="header.json">
  </head>
  <body></body>
</html>
"#;
match get_web_header_json_value::<serde_json::Value>(html).unwrap() {
    HeaderQueryContent::Url(u) => assert_eq!(u, "header.json"),
    _ => unreachable!(),
}

Modules§

reqwestreqwest
Network fetching module based on reqwest

Enums§

HeaderQueryContent
Return type of get_web_header_json_value.

Functions§

extract_bmstable_url
Extract the JSON file URL pointed to by the bmstable field from HTML page content.
get_web_header_json_value
Parse a response string into the header JSON or its URL.