Unofficial Go implementation of HowLongToBeat website API
$ go get github.com/RedSkiesReaperr/howlongtobeat
hltb, err := howlongtobeat.New()
if err != nil {
// error management
}
request, err := howlongtobeat.NewSearchRequest("elden ring")
if err != nil {
// error management
}
result, err := hltb.Search(request)
if err != nil {
// error management
}
for _, game := range result.Data {
fmt.Println(game.Name)
}
After creating a SearchRequest you can send it as is or customize it, to do so you have several options:
request.SetSearchTerms("new terms")
You can find a list of available platforms here
request.SetPlatform(howlongtobeat.PlatformPC)
// Retrieve page number 2 with a page size of 25
request.SetPagination(2, 25)
You can find a list of available modifiers here
request.SetModifier(howlongtobeat.ModifierOnlyDlc)
You can find a list of available sort kinds here
request.SetSorting(howlongtobeat.SortByReleaseDate)
You can find a list of available gameplay parts here
request.SetGameplay(howlongtobeat.PerspectiveThirdPerson, howlongtobeat.FlowPointAndClick, howlongtobeat.GenreHorror)
Thanks to all the authors who created and maintains the following packages:
If you wish to contribute to this project, please follow these steps:
- Fork this repository.
- Create a branch for your feature: git checkout -b feature/feature-name
- Commit your changes: git commit -m 'Added a new feature'
- Push your branch: git push origin feature/feature-name
- Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details. Feel free to open issues or submit feature requests if you have ideas to enhance this project.