A Rust library to fetch and parse BMS difficulty tables. It can build a complete data structure from a web page or a header JSON, covering the header, courses, trophies and chart items, and it provides APIs to fetch lists of tables.
- Extract the header JSON URL from HTML
<meta name="bmstable">(requiresscraper). - Parse the header JSON into
BmsTableHeader; unrecognized fields are preserved inextra. - Parse chart data into
BmsTableData, supporting a plain array ofChartItemstructure. - Automatically convert
md5/sha256lists in courses toChartItem; whenlevelis missing, fill with "0". - One-stop network fetching APIs (enable
reqwest, which implicitly enablesscraper). - Fetch a list of difficulty tables.
serde: serialization/deserialization support (enabled by default).scraper: HTML parsing and bmstable header URL extraction (enabled by default; implicitly enabled byreqwest).reqwest: network fetching implementation (enabled by default; requires thetokioruntime).
BmsTable: top-level data structure containingheaderanddata.BmsTableHeader: header metadata; unrecognized fields are preserved inextra.BmsTableData: chart data as an array.CourseInfo: course information; supports automatically convertingmd5/sha256lists to chart items.ChartItem: a chart item; empty strings are deserialized asNone.Trophy: trophy requirements (max miss rate, minimum score rate).fetch::reqwest::fetch_table(url): fetch and parse a complete table from a web page or a header JSON source.fetch::reqwest::fetch_table_full(url): return both the parsed table and the original header/data JSON texts.fetch::reqwest::fetch_table_list(url): fetch a list of difficulty tables.fetch::reqwest::fetch_table_list_full(url): return the list items along with the original JSON text.fetch::get_web_header_json_value(str): parse a response string into header JSON or its URL (HeaderQueryContent).fetch::extract_bmstable_url(html): extract the bmstable header URL from HTML.
examples/single_fetch_list.rs: fetch the table list once and print the first few items.examples/multi_fetch.rs: concurrently fetch multiple tables and print progress and results.
docs.rs: https://docs.rs/bms-table- Repository: https://github.com/MiyakoMeow/bms-table-rs
Licensed under the Apache-2.0 license.