メロンから取得したサムネイルからcensored flagらしきパラメータを外す

This commit is contained in:
shibafu 2019-01-10 01:29:26 +09:00
parent ad5fbc7ada
commit 581c1ed952

View File

@ -14,7 +14,14 @@ class MelonbooksResolver implements Resolver
$res = $client->get($url, ['cookies' => $cookieJar]); $res = $client->get($url, ['cookies' => $cookieJar]);
if ($res->getStatusCode() === 200) { if ($res->getStatusCode() === 200) {
$ogpResolver = new OGPResolver(); $ogpResolver = new OGPResolver();
return $ogpResolver->parse($res->getBody()); $metadata = $ogpResolver->parse($res->getBody());
// censoredフラグの除去
if (mb_strpos($metadata->image, '&c=1') !== false) {
$metadata->image = preg_replace('/&c=1/u', '', $metadata->image);
}
return $metadata;
} else { } else {
throw new \RuntimeException("{$res->getStatusCode()}: $url"); throw new \RuntimeException("{$res->getStatusCode()}: $url");
} }