ivankayzer / howlongtobeat
howlongtobeat.com 提供有关游戏及其完成所需时间的信息。此库是一个简单的包装器,用于从 Howlongtobeat 网站获取数据
1.1.0
2022-10-29 14:12 UTC
Requires
- php: ^7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- symfony/css-selector: ^5.4
- symfony/dom-crawler: ^5.4
Requires (Dev)
- mockery/mockery: ^1.3
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-09-19 23:19:48 UTC
README
关于
howlongtobeat 提供关于游戏及其完成所需时间的信息和数据。
此库是一个简单的包装器,用于从 howlongtobeat.com 获取数据。请访问他们的网站,并在喜欢他们所做的事情时支持他们。
安装
使用包管理器 composer 安装 howlongtobeat。
composer require ivankayzer/howlongtobeat
使用方法
搜索
use IvanKayzer\HowLongToBeat\HowLongToBeat; $hl2b = new HowLongToBeat(); $hl2b->search('Lego');
返回
{ "Results": [ { "ID": "5265", "Image": "https://howlongtobeat.com/gameimages/220px-Lego_Lord_of_the_Rings_cover.jpg", "Title": "LEGO The Lord of the Rings: The Video Game", "Summary": { "Main Story": "10 Hours", "Main + Extra": "16 Hours", "Completionist": "33 Hours" } }, { "ID": "5263", "Image": "https://howlongtobeat.com/gameimages/256px-Lego_Star_Wars-The_Complete_Saga.jpg", "Title": "LEGO Star Wars: The Complete Saga", "Summary": { "Main Story": "14 Hours", "Main + Extra": "23 Hours", "Completionist": "39.5 Hours" } }, { "ID": "16635", "Image": "https://howlongtobeat.com/gameimages/LegoTheHobbit.jpg", "Title": "LEGO The Hobbit", "Summary": { "Main Story": "9 Hours", "Main + Extra": "16 Hours", "Completionist": "35.5 Hours" } }, ... ], "Pagination": { "Current Page": 1, "Last Page": 4 } }
您也可以将页面号作为 search
的第二个参数传递
$hl2b->search('Lego', 2);
通过游戏 ID 获取时间条目
use IvanKayzer\HowLongToBeat\HowLongToBeat; $hl2b = new HowLongToBeat(); $hl2b->get(5265);
返回
{ "ID": 5265, "Title": "LEGO The Lord of the Rings: The Video Game", "Image": "https://howlongtobeat.com/gameimages/220px-Lego_Lord_of_the_Rings_cover.jpg", "Description": "LEGO The Lord of the Rings is based on The Lord of the Rings motion picture trilogy and follows the original storylines of The Lord of the Rings: The Fellowship of the Ring, The Lord of the Rings: The Two Towers, and The Lord of the Rings: The Return of the King. Now the entire family can team up in pairs as adorable LEGO The Lord the Rings minifigures to experience countless dangers, solve riddles and battle formidable foes on their journey to Mount Doom.", "Developer": "Traveller's Tales", "Publisher": "Warner Bros. Interactive Entertainment", "Last Update": "4 Hours Ago", "Playable On": "PC, Nintendo 3DS, Nintendo DS, PlayStation 3, PlayStation Vita, Wii, Wii U, Xbox 360, Xbox One", "Genres": "Action, Adventure, Open World", "Statistics": { "Playing": "220", "Backlogs": "2300", "Replays": "34", "Retired": "5%", "Rating": "75%", "Beat": "1100" }, "Summary": [ { "Title": null, "Time": { "Main Story": "10 Hours", "Main + Extras": "16 Hours", "Completionist": "33 Hours", "All Styles": "17.5 Hours" } } ], "Single-Player": { "Main Story": { "Polled": "182", "Average": "9h 55m", "Median": "10h", "Rushed": "7h 25m", "Leisure": "14h 58m" }, "Main + Extras": { "Polled": "109", "Average": "16h 48m", "Median": "15h", "Rushed": "11h 23m", "Leisure": "27h 57m" }, ... }, "Speedrun": { "Any%": { "Polled": "2", "Average": "4h 51m 43s", "Median": "4h 51m 43s", "Fastest": "4h 23m 56s", "Slowest": "5h 19m 30s" } }, "Multi-Player": { "Co-Op": { "Polled": "14", "Average": "17h 12m", "Median": "13h 27m", "Least": "10h 54m", "Most": "28h 15m" } }, "Platform": { "Nintendo 3DS": { "Polled": "24", "Main": "9h 34m", "Main +": "21h 15m", "100%": "22h 56m", "Fastest": "4h 52m", "Longest": "60h" }, ... } }
贡献
欢迎拉取请求。对于重大更改,请先打开一个问题来讨论您想要更改的内容。