Skip to content

Latest commit

 

History

History
73 lines (60 loc) · 1.85 KB

README.md

File metadata and controls

73 lines (60 loc) · 1.85 KB

HowLongToBeat Wrapper

About & Credits

How long to beat provides information and data about games and how long it will take to finish them. It's a great website which relies heavily from community data.

This package is a simple wrapper api to fetch data from How long to beat (search and detail). Please use this responsibly.

Usage

Install

Install the library using nuget package manager (search for HowLongToBeat) or using Package Manager Console

Install-Package HowLongToBeat

Install the library using .NET CLI

dotnet add package HowLongToBeat

Sample Code

  • Import namespace
using HowLongToBeat;
  • Instantiate the HLTBWebScraper object and use the Search() method
    • Note: it depends on a HttpClient instance
var httpClient = new HttpClient();
var ws = new HLTBWebScraper(httpClient);

var query = "Halo";
var result = await ws.Search(query);

Example Result

[
  {
    "title": "Halo Infinite",
    "imgURL": "https://howlongtobeat.com/games/57454_Halo_Infinite.jpg",
    "main": "10½ Hours",
    "mainAndExtras": "17½ Hours",
    "completionist": "25 Hours"
  },
  {
    "title": "Halo: The Master Chief Collection",
    "imgURL": "https://howlongtobeat.com/games/Halo_Collection.jpg",
    "main": "",
    "mainAndExtras": "",
    "completionist": ""
  },
  {
    "title": "Halo 3",
    "imgURL": "https://howlongtobeat.com/games/256px-Halo_3_final_boxshot.JPG",
    "main": "8 Hours",
    "mainAndExtras": "11½ Hours",
    "completionist": "18½ Hours"
  },
  {
    "title": "Halo: Combat Evolved",
    "imgURL": "https://howlongtobeat.com/games/Halobox.jpg",
    "main": "10 Hours",
    "mainAndExtras": "11 Hours",
    "completionist": "13 Hours"
  }
]