{"_id":"@btylerw/howlongtobeat","name":"@btylerw/howlongtobeat","dist-tags":{"latest":"1.8.0"},"versions":{"1.8.0":{"name":"@btylerw/howlongtobeat","version":"1.8.0","main":"dist/main/howlongtobeat.js","author":{"name":"Christian Katzorke","email":"ckatzorke@gmail.com"},"license":"WTFPL","scripts":{"build":"tsc","pretest":"tsc --sourcemap","test":"nyc mocha dist/test/**/*.test.js","integrationtest":"nyc mocha dist/test/*.integration.test.js","posttest":"nyc report --reporter=json && codecov -f coverage/*.json"},"repository":{"type":"git","url":"git+https://github.com/btylerw/howlongtobeat.git"},"bugs":{"url":"https://github.com/btylerw/howlongtobeat/issues"},"homepage":"https://github.com/btylerw/howlongtobeat","dependencies":{"axios":"^1.6","cheerio":"^1.0.0-rc.12","fast-levenshtein":"^2.0.6","user-agents":"^1.0.580"},"devDependencies":{"@types/chai":"^3.5.2","@types/chai-as-promised":"^0.0.30","@types/mocha":"^2.2.41","@types/node":"^7.0.14","chai":"^3.5.0","chai-as-promised":"^6.0.0","codecov":"^3.7.1","hoek":"^5.0.4","mocha":"^10.0.0","nyc":"^15.0.0","typescript":"^5.8.3"},"_id":"@btylerw/howlongtobeat@1.8.0","gitHead":"46370dc17c575edc9606b0ac34cd243b1fc551ee","types":"./dist/main/howlongtobeat.d.ts","description":"[![Latest Build Status](https://api.travis-ci.org/ckatzorke/howlongtobeat.svg?branch=master)](https://travis-ci.org/ckatzorke/howlongtobeat)\r [![npm version](https://badge.fury.io/js/howlongtobeat.svg)](https://badge.fury.io/js/howlongtobeat)\r [![codecov]","_nodeVersion":"22.17.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-u6Gdxb6skiJ845ChM1gLACpIXetTqtSAeDbs87Qna/WpcnROVFyaXKvIM3n2suXuzYf2Nn5P9C0a78U8UX9IfA==","shasum":"ffc99e0085b3dc71ea0efa42d077053347b8cf37","tarball":"https://registry.npmjs.org/@btylerw/howlongtobeat/-/howlongtobeat-1.8.0.tgz","fileCount":46,"unpackedSize":280866,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDJMbwgLmrN7WDIuSGc7I2y2Qrk+Yrlre8v/BA4ncCfhwIgGqjcVCZhjBMltBfb2VwV0b8JC+JOkRHZLaon0g5JUtU="}]},"_npmUser":{"name":"btylerw","email":"brown.tyler.w@gmail.com"},"directories":{},"maintainers":[{"name":"btylerw","email":"brown.tyler.w@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/howlongtobeat_1.8.0_1752381393137_0.6042853557845906"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-13T04:36:32.950Z","1.8.0":"2025-07-13T04:36:33.322Z","modified":"2025-07-13T04:36:33.710Z"},"maintainers":[{"name":"btylerw","email":"brown.tyler.w@gmail.com"}],"description":"[![Latest Build Status](https://api.travis-ci.org/ckatzorke/howlongtobeat.svg?branch=master)](https://travis-ci.org/ckatzorke/howlongtobeat)\r [![npm version](https://badge.fury.io/js/howlongtobeat.svg)](https://badge.fury.io/js/howlongtobeat)\r [![codecov]","homepage":"https://github.com/btylerw/howlongtobeat","repository":{"type":"git","url":"git+https://github.com/btylerw/howlongtobeat.git"},"author":{"name":"Christian Katzorke","email":"ckatzorke@gmail.com"},"bugs":{"url":"https://github.com/btylerw/howlongtobeat/issues"},"license":"WTFPL","readme":"# Howlongtobeat API\r\n\r\n[![Latest Build Status](https://api.travis-ci.org/ckatzorke/howlongtobeat.svg?branch=master)](https://travis-ci.org/ckatzorke/howlongtobeat)\r\n[![npm version](https://badge.fury.io/js/howlongtobeat.svg)](https://badge.fury.io/js/howlongtobeat)\r\n[![codecov](https://codecov.io/gh/ckatzorke/howlongtobeat/branch/master/graph/badge.svg)](https://codecov.io/gh/ckatzorke/howlongtobeat)\r\n\r\n## About & Credits\r\n\r\n[How long to beat](https://howlongtobeat.com/) provides information and data about games and how long it will take to finish them.\r\n\r\nThis library is a simple wrapper api to fetch data from [How long to beat](https://howlongtobeat.com/) (search and detail).\r\nIt is an awesome website and a great service, also heavily living from community data. Please check the website and [support](https://howlongtobeat.com/donate.php) if you like what they are doing.\r\n\r\n## Usage\r\n\r\n### Install the dependency\r\n\r\n```javascript\r\nnpm install howlongtobeat --save\r\n```\r\n\r\n### Use in code\r\n\r\n#### Add imports\r\n\r\n* javascript\r\n\r\n```javascript\r\nlet hltb = require('howlongtobeat');\r\nlet hltbService = new hltb.HowLongToBeatService();\r\n```\r\n\r\n* typescript\r\n\r\n```typescript\r\nimport { HowLongToBeatService, HowLongToBeatEntry } from 'howlongtobeat';\r\n\r\nlet hltbService = new HowLongToBeatService();\r\n```\r\n\r\n#### Searching for a game\r\n\r\n```javascript\r\nhltbService.search('Nioh').then(result => console.log(result));\r\n```\r\n\r\n`search()` will return a `Promise` with an `Array<HowLongToBeatEntry>`\r\n\r\n* Search response example:\r\n\r\n```javascript\r\n[ {\r\n    id: '36936',\r\n    name: 'Nioh',\r\n    imageUrl: 'https://howlongtobeat.com/gameimages/36936_Nioh.jpg',\r\n    timeLabels: [ [Array], [Array], [Array] ],\r\n    gameplayMain: 34.5,\r\n    gameplayMainExtra: 61,\r\n    gameplayCompletionist: 93.5,\r\n    similarity: 1,\r\n    searchTerm: 'Nioh'\r\n    },\r\n    {\r\n    id: '50419',\r\n    name: 'Nioh: Complete Edition',\r\n    imageUrl: 'https://howlongtobeat.com/gameimages/50419_Nioh_Complete_Edition.jpg',\r\n    timeLabels: [ [Array], [Array], [Array] ],\r\n    gameplayMain: 42,\r\n    gameplayMainExtra: 84,\r\n    gameplayCompletionist: 97,\r\n    similarity: 0.18,\r\n    searchTerm: 'Nioh'\r\n    },\r\n    ...\r\n]\r\n```\r\n\r\n#### Getting details for a game\r\n\r\n```javascript\r\nhltbService.detail('36936').then(result => console.log(result)).catch(e => console.error(e));\r\n```\r\n\r\nThe `detail()` method will return a `Promise` with an `HowLongToBeatEntry`. If the id is not known, an error is thrown, you should catch the Promise anyway.\r\n\r\n* Detail response example:\r\n\r\n```javascript\r\n{\r\n  id: '36936',\r\n  name: 'Nioh',\r\n  imageUrl: 'https://howlongtobeat.com/gameimages/36936_Nioh.jpg',\r\n  timeLabels:\r\n   [ [ 'gameplayMain', 'Main Story' ],\r\n     [ 'gameplayMainExtra', 'Main + Extras' ],\r\n     [ 'gameplayComplete', 'Completionist' ] ],\r\n  gameplayMain: 34.5,\r\n  gameplayMainExtra: 61,\r\n  gameplayCompletionist: 93.5,\r\n  similarity: 1,\r\n  searchTerm: 'Nioh'\r\n}\r\n```\r\n\r\n## Time Labels\r\n\r\nHLTB has 7 differents ways to count games hours, here they are:\r\n\r\n* Main Story\r\n* Main + Extras\r\n* Completionist\r\n* Single-Player\r\n* Solo\r\n* Co-Op\r\n* Vs.\r\n\r\nUse the `timeLabels` attribute for mapping purposes\r\n\r\n## Known issues\r\n\r\n### Missing features\r\n\r\n* Error and Exception handling is almost not present, must be improved\r\n\r\n## License\r\n\r\n![WTFPL](http://www.wtfpl.net/wp-content/uploads/2012/12/wtfpl-badge-4.png)\r\n","readmeFilename":"README.md","_rev":"1-2cc22526a7ea87fd9b15b125343cc55d"}