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§
- reqwest
reqwest - Network fetching module based on
reqwest
Structs§
- Fetched
Table - Result of fetching a table with its raw JSON strings.
- Fetched
Table List - Result of fetching a table list with its raw JSON string.
Enums§
- Header
Query Content - Return type of
get_web_header_json_value.
Traits§
- Table
Fetcher - Unified interface for fetching BMS tables.
Functions§
- get_
web_ header_ json_ value - Parse a response string into the header JSON or its URL.
- header_
query_ with_ fallback - Extract the header query content from a response string with a fallback cleaning step.
- parse_
json_ str_ with_ fallback - Parse JSON from a raw string with a cleaning fallback.
- replace_
control_ chars - Remove non-printable control characters from JSON text.
- try_
extract_ bmstable_ from_ html - Extract the JSON file URL pointed to by the bmstable field from HTML page content.