9 Yrs
sunsean
#1
's Avatar
9 Yrs
I was wondering if there are plans to expose the play times and play styles for each game via an API. Looking for the game details and search via something similar to digest like JSON.

This site is a critical component to my purchasing decisions and planning which order to play games. Thank you so for curating such an amazing collection of information!
10 Yrs$#
orngcav067
#2
's Avatar
10 Yrs$#
+1

This would be awesome.
9 Yrs
asyncro
#3
's Avatar
9 Yrs
Yep, would love this as well.
9 Yrs
asyncro
#4
's Avatar
9 Yrs
I was digging around and found IGDB.com has a public, free API. https://www.igdb.com/api
Their library of games probably isn't as large as HL2B's at this point, and not all games even have play time stats yet but it seems to be growing rapidly (they recently got funded and have have 4 full time developers) If you want playtime data in a public API this seems to be the best option at the moment.

* Giant Bomb: Public, free API, most titles but not play time data or statistics
* HL2B: Extensive play time data and statistics but no public API
* IGDB: Limited play time data, and public free API

mferreir
#5
's Avatar
Hey guys,

I noticed that https://howlongtobeat.com/api have some documentation of how the API would work. Unfortunately there is no way to obtain an API key. Does anyone know if there is a hidden form somewhere or providing a public API is not on HLTB plans?

Thank you!
8 Yrs
CyberFox
#6
's Avatar
8 Yrs
page does not exist. They must have taken the page down huh?
So no word on a public API and there is no EULA to be found.

Not taking the hint we can just reverse engineer it. Aaand since there is no page stating we can't, knock your selves out. Making time tracking unattended and submitted to the server automatically sounds really pleasant to me so I'm guess 'll dong exactly that.
8 Yrs
seb231
#7
's Avatar
8 Yrs
Is anyone pursuing this? Would be an amazing asset!
11 Yrs
chiefsucker
#8
's Avatar
11 Yrs
A public API / per user API with automatically generated, changeable keys on the preferences page would be great.
lorenzos
#9
's Avatar
I'm the developer of Steam Filters. I receive lot of requests about using HL2B data for sorting libraries and stuff, so a public API will be great.

Maybe we can arrange something to make it work without an API? I see for example this scraper project: it looks like it's working well, but I don't like using HTML page parsing methods (not only they are inconvenient, but I guess it's not a kind thing to do for HL2B servers).

To HL2B admins, maybe we can collaborate somehow?

@asyncro Thanks, I didn't know about IGDB. Maybe I could try to use their API and see if their data is big enough to make it at least useful for my use case.
8 Yrs
seb231
#10
's Avatar
8 Yrs
@lorenzos I'd also be happy to contribute, see here for the work I'm trying to do: https://howlongtobeat.com/forum.php?&thread=1160

The recent change to Steam auto-privacy settings has messed up my project and I'd imagine it has for Steam Filters too :(

I'd love to be happy to pull data from a different (and independent!) source, like HLTB
kultuk
#11
's Avatar
+1 to the public API request.

i wanted to create an alexa skill for the site and i don't really like the scrapper option.
hopefully someone will open that up.
lord_gr
#12
's Avatar
An API would be extremely useful.
7 Yrs
Anthirian
#13
's Avatar
7 Yrs
I would also like to request this, not only for retrieving data from HL2B, but also for integrating third party software with HL2B in order to upload stats automatically.
syphen
#14
's Avatar
Replying to Anthirian
I think depending on how badly you want that data...you can always find a way to get it. Sure, scraping isn't the most elegant thing, but it works in a pinch.

Case in point:
https://dev.syphen.org/gaming/details.php?query[]=Red%20Dead%20Redemption%202&query[]=Control&type[]=main_plus&type[]=main&platform=PC

Built this page to pull data from HL2B. Each variable (query, type, platform) can either be a string or an array and it will filter info down from the completions page of a game, assuming it can find a match.

The type variable can accept these values: main, main_plus, complete, no_time, speed
Tuxgamer
#15
's Avatar
Hi,
I'd have no problem with scraping, more kindly asking for permission ;).

I'm working on something like a Game Client (Open Source). I'd really like to include information how long each game is. Information from howlongtobeat.com would be scraped once per game and then cached; obviously I'd add appropriate credits.

Since I didn't find anything, would this generally be OK or is scraping rather not welcome?
BlankedyBlank
#16
's Avatar
I've been taking a look in the browser DevTools and playing around; I suspect this is what several people in this thread are doing already but I thought I'd document it here for others:

You can send a POST request to https://howlongtobeat.com/search_results?page=1 with no auth and Content-Type x-www-form-urlencoded. Content looks like so:

queryString=bugsnax
&t=games
&sorthead=popular
&sortd=Normal%20Order
&plat=PC
&length_type=main
&length_min=
&length_max=
&detail=user_stats
&randomize=0

Which are the filters available when you click 'search options'. "detail" is the "modifiers" option, and useful values are 'user_stats', 'hide_dlc' and 'only_dlc'. They cannot be combined.

Response is HTML and the elements you'd see on the page, so select appropriately,

A proper API would be really, really nice, but until then I'm just going to have to scrape with this.

Edit: found a wrapper on Github.
9 Yrs#
GamerAim
Squashed
#17
's Avatar
9 Yrs#
Replying to BlankedyBlank
I'm assuming an API will be forthcoming much sooner now that Everdred has secured...backing to work on the site full time. I would be surprised if that was not made one of his priorities.
9 Yrs$#
Sora1248
Lord of War
#18
's Avatar
9 Yrs$#
Replying to GamerAim
I also like a public API as there's some stuff I really like to try... But so far I put that off because web scraping is unethical in my opinion and if I have to do it I make sure to limit my impact as good as I can: Get stuff only once (caching) and rate limit the hell out of it...
So, in my opinion it's a bit shady to also advertise it... Has anyone got the consent from Everdred to scrape the site? Under which conditions? How to make sure to not overload the server?

Sure, I cannot speak for Everdred but that's something that annoys me... especially as I'm greeted with a message that the server is overloaded every now and then already.
9 Yrs#
GamerAim
Squashed
#19
's Avatar
9 Yrs#
Replying to Sora1248
Yeah, web scraping feels...iffy to me, if only because of the server bandwidth. Especially on an independent site. I used to feel it was shady the way people advertised their scraping (especially with plugins and stuff, which did get his apparent consent), but now that the site isn't independent, I don't think it matters now except for - as you say - overloading the site for other users. After all, improved servers are just another corporate expense, right?

So yeah, I don't have see the point in sympathy anymore.
13 YrsF#
Everdred
Staff
#20
's Avatar
13 YrsF#
Scrapping is a grey area and many people have no issue doing it. Many have scraped the site without authorization, I have never actively tried to stop it.

My personal opinion is that scrapping feels gross unless you are obtaining your own data. I only use official APIs when available or build my own solution. I believe scrapping is unethical if you are profiting or causing detriment to a site.

I have nothing to announce about an API right now. Server stability and performance are my main focus for the time being.

Edit: modified to clarify...
9 Yrs#
GamerAim
Squashed
#21
's Avatar
9 Yrs#
Replying to Everdred
As "gross" as it feels to me, I've scraped sites...sometimes you just need data and there's no other way to get it. But even then it's a one-time thing, not something like a plugin that will frequently scrape a site. I don't want to make a habit of it...like overstaying a welcome. Or worse, being a door-to-door salesman. *shudders*
13 YrsF#
Everdred
Staff
#22
's Avatar
13 YrsF#
Replying to GamerAim
Sorry, I should clarify. If it's for yourself or learning purposes, I don't consider it gross at all.
6 Yrs
UncleSamsEagle
#23
's Avatar
6 Yrs
Just adding my two cents in favor of an API! It's a great site and scraping would get the job done, but official APIs are usually much more elegant and provide a vision in line with what the site has been created for. I totally understand the focus on performance/stability though.
greenthingsjump
#24
's Avatar
I would love an API!!! How could we start one without waiting for howlongtobeat.com?
dege13
#25
's Avatar
+1 for an API. I want @lorenzos to add to his site so that I can check my personal Steam library for what games to play.
@Everdred Is there a way to donate to HLTB to help with the stability and performance goals? Or a way to help get the API feature prioritized?