mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
46 lines
1.4 KiB
PHP
Executable File
46 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
require_once dirname(__DIR__, 3).DIRECTORY_SEPARATOR.'bootstrap/autoload.php';
|
|
|
|
// Test if your giantbomb key is working.
|
|
|
|
use Blacklight\db\DB;
|
|
use Blacklight\ColorCLI;
|
|
|
|
$giantbombkey = (new DB())->getSetting('giantbombkey');
|
|
$cli = new ColorCLI();
|
|
$obj = new GiantBomb($giantbombkey, $resp = 'json');
|
|
|
|
$searchgame = 'South Park The Stick of Truth';
|
|
$resultsfound = 0;
|
|
|
|
$e = null;
|
|
try {
|
|
$fields = [
|
|
'deck', 'description', 'original_game_rating', 'api_detail_url', 'image', 'genres', 'name',
|
|
'platforms', 'publishers', 'original_release_date', 'reviews', 'site_detail_url',
|
|
];
|
|
$result = $obj->search($searchgame, $fields, 1);
|
|
$result = json_decode(json_encode($result), true);
|
|
if ($result['number_of_total_results'] != 0) {
|
|
$resultsfound = count($result['results']);
|
|
for ($i = 0; $i <= $resultsfound; $i++) {
|
|
similar_text($result['results'][$i]['name'], $searchgame, $p);
|
|
if ($p > 90) {
|
|
$result = $result['results'][$i];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} catch (\Exception $e) {
|
|
$result = false;
|
|
}
|
|
|
|
if ($result !== false && ! empty($result)) {
|
|
print_r($result);
|
|
exit($cli->header("\nLooks like it is working alright."));
|
|
} else {
|
|
print_r($e);
|
|
exit($cli->error("\nThere was a problem attempting to query giantbomb. Maybe your key is wrong, or you are being throttled.\n"));
|
|
}
|