Codepotatoes.Scraper.HowLongToBeat 1.2.0

dotnet add package Codepotatoes.Scraper.HowLongToBeat --version 1.2.0
                    
NuGet\Install-Package Codepotatoes.Scraper.HowLongToBeat -Version 1.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Codepotatoes.Scraper.HowLongToBeat" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Codepotatoes.Scraper.HowLongToBeat" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Codepotatoes.Scraper.HowLongToBeat" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Codepotatoes.Scraper.HowLongToBeat --version 1.2.0
                    
#r "nuget: Codepotatoes.Scraper.HowLongToBeat, 1.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Codepotatoes.Scraper.HowLongToBeat&version=1.2.0
                    
Install Codepotatoes.Scraper.HowLongToBeat as a Cake Addin
#tool nuget:?package=Codepotatoes.Scraper.HowLongToBeat&version=1.2.0
                    
Install Codepotatoes.Scraper.HowLongToBeat as a Cake Tool

HowLongToBeatScraper

NuGet Version nuget version

As we're still missing an api to fetch data from Howlongtobeat
this project aims to bridge the gap in the meantime.

Usage

Install the package:

dotnet add package Crashdummy.Scraper.HowLongToBeat


using var scraper = new HltbScraper();
// or
using var scraper = new HltbScraper(seekMagic: "d4b2e330db04dbf3")

// Simple search with works as in using the howlongtobeat.com page
IEnumerable<GameEntry> results = await scraper.Search("Borderlands 3");

// Advanced search
var query = new QueryBuilder().WithSearchType(SearchOptions.Type.Users)
                              .WithModifier(SearchOptions.Modifier.HideModsAndDlc);

IEnumerable<GameEntry> results = await scraper.Search(query);

Regarding the "seekmagic"

The main endpoint that is being used is /api/Seek/<seekMagic>.
This requires however to obtain a magic hash that can be found in two different ways:

  • Somewhere in the depths of the **/_app*.js file
  • Checking the POST request in the developer console when accessing howlongtobeat.com

The constructor can be empty. In this case the _app*.js file is downloaded and parsed. This will fail eventually and takes a bit longer during the first request ( duh ).

If feasible its highly recommended to preemptively set the magic.

Dependencies

For some reason /api/price-checks/<gameid>, only returns the gogAppId. The SteamAppId has to be provided within the body which thus defeats the purpose. Until theres a better way we need to scrape it there

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 25 6/1/2025
1.1.0 113 5/28/2025
1.0.0 110 5/28/2025