Add command to check Kitsu's MAL id mappings
This commit is contained in:
parent
a8f898822a
commit
ae283cd898
@ -23,7 +23,7 @@
|
|||||||
"aura/router": "^3.0",
|
"aura/router": "^3.0",
|
||||||
"aura/session": "^2.0",
|
"aura/session": "^2.0",
|
||||||
"aviat/banker": "^1.0.0",
|
"aviat/banker": "^1.0.0",
|
||||||
"aviat/ion": "^2.3.0",
|
"aviat/ion": "^2.4.1",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-gd":"*",
|
"ext-gd":"*",
|
||||||
"ext-pdo": "*",
|
"ext-pdo": "*",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"psr/http-message": "~1.0",
|
"psr/http-message": "~1.0",
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
"yosymfony/toml": "^1.0",
|
"yosymfony/toml": "^1.0",
|
||||||
"zendframework/zend-diactoros": "^1.3"
|
"zendframework/zend-diactoros": "^2.0.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"consolidation/robo": "~1.0",
|
"consolidation/robo": "~1.0",
|
||||||
@ -43,7 +43,7 @@
|
|||||||
"phpstan/phpstan": "^0.9.1",
|
"phpstan/phpstan": "^0.9.1",
|
||||||
"phpunit/phpunit": "^6.0",
|
"phpunit/phpunit": "^6.0",
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"robmorgan/phinx": "^0.9.1",
|
"robmorgan/phinx": "^0.10.6",
|
||||||
"sebastian/phpcpd": "^3.0",
|
"sebastian/phpcpd": "^3.0",
|
||||||
"spatie/phpunit-snapshot-assertions": "^1.2.0",
|
"spatie/phpunit-snapshot-assertions": "^1.2.0",
|
||||||
"squizlabs/php_codesniffer": "^3.2.2",
|
"squizlabs/php_codesniffer": "^3.2.2",
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Command;
|
namespace Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
use const Aviat\AnimeClient\MILLI_FROM_NANO;
|
|
||||||
use const Aviat\AnimeClient\SRC_DIR;
|
use const Aviat\AnimeClient\SRC_DIR;
|
||||||
|
|
||||||
use function Amp\Promise\wait;
|
use function Amp\Promise\wait;
|
||||||
@ -158,8 +157,6 @@ final class MALIDCheck extends BaseCommand {
|
|||||||
|
|
||||||
if ($response->getStatus() === 404)
|
if ($response->getStatus() === 404)
|
||||||
{
|
{
|
||||||
dump($titles);
|
|
||||||
die();
|
|
||||||
$badMappings[$id] = $titles;
|
$badMappings[$id] = $titles;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -177,8 +174,6 @@ final class MALIDCheck extends BaseCommand {
|
|||||||
|
|
||||||
if (mb_stripos($body, $title) !== FALSE)
|
if (mb_stripos($body, $title) !== FALSE)
|
||||||
{
|
{
|
||||||
// echo "MAL id {$id} seems to match \"{$title}\"\n";
|
|
||||||
|
|
||||||
$titleMatches = TRUE;
|
$titleMatches = TRUE;
|
||||||
$goodMappings[$id] = $title;
|
$goodMappings[$id] = $title;
|
||||||
|
|
||||||
@ -209,7 +204,7 @@ final class MALIDCheck extends BaseCommand {
|
|||||||
{
|
{
|
||||||
$baseUrl = "https://myanimelist.net/{$type}/";
|
$baseUrl = "https://myanimelist.net/{$type}/";
|
||||||
|
|
||||||
$requestChunks = array_chunk($ids, 10, TRUE);
|
$requestChunks = array_chunk($ids, 50, TRUE);
|
||||||
$responses = [];
|
$responses = [];
|
||||||
|
|
||||||
// Chunk parallel requests so that we don't hit rate
|
// Chunk parallel requests so that we don't hit rate
|
||||||
@ -221,7 +216,6 @@ final class MALIDCheck extends BaseCommand {
|
|||||||
foreach($idChunk as $id)
|
foreach($idChunk as $id)
|
||||||
{
|
{
|
||||||
$request = APIRequestBuilder::simpleRequest($baseUrl . $id);
|
$request = APIRequestBuilder::simpleRequest($baseUrl . $id);
|
||||||
echo "Checking {$baseUrl}{$id} \n";
|
|
||||||
$requester->addRequest($request, (string)$id);
|
$requester->addRequest($request, (string)$id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,12 +223,6 @@ final class MALIDCheck extends BaseCommand {
|
|||||||
{
|
{
|
||||||
$responses[$id] = $response;
|
$responses[$id] = $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Finished checking chunk of 10 entries\n";
|
|
||||||
|
|
||||||
// Rate limiting is annoying :(
|
|
||||||
// sleep(1);
|
|
||||||
// time_nanosleep(0, 250 * MILLI_FROM_NANO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $responses;
|
return $responses;
|
||||||
|
Loading…
Reference in New Issue
Block a user