#com #scraper #api #how #game #howlongtobeat #hltb

howlongtobeat-scraper

Simple api for https://howlongtobeat.com

1 unstable release

new 0.1.0 Jan 16, 2025

#722 in Web programming

MIT license

15KB
226 lines

howlongtobeat-scraper

Simple API for HowLongToBeat.

Description

howlongtobeat-scraper is a Rust library that provides a simple API to interact with the HowLongToBeat website. It allows you to scrape game information such as playtime estimates.

Installation

Add the following to your Cargo.toml:

[dependencies]
howlongtobeat-scraper = "0.1.0"

Usage

Here is a basic example of how to use the library:

use howlongtobeat_scraper::HowLongToBeatScraper;

fn main() {
    let game_info = search_by_name("The Legend of Zelda: Breath of the Wild").unwrap();
    println!("{:?}", game_info);
}

Output

The output will be a JSON string containing the game information. For example:

{
    "hltb_id": 2127,
    "title": "Cyberpunk 2077",
    "main_story": {
        "average": 94860.0,
        "median": 88920.0,
        "rushed": 63900.0,
        "leisure": 153900.0
    },
    "main_extra": {
        "average": 233520.0,
        "median": 216000.0,
        "rushed": 135060.0,
        "leisure": 630780.0
    },
    "completionist": {
        "average": 399480.0,
        "median": 362100.0,
        "rushed": 273180.0,
        "leisure": 1102980.0
    },
    "all_styles": {
        "average": 246180.0,
        "median": 216000.0,
        "rushed": 133500.0,
        "leisure": 1028100.0
    }
}

Features

  • Scrape game information from HowLongToBeat
  • Retrieve playtime estimates for different game categories

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Author

Arnaud BEUX - GitHub - nytuo.yt@gmail.com

Dependencies

~19–35MB
~556K SLoC