FANZA: 年齢認証Cookieを送信する

This commit is contained in:
shibafu 2020-07-09 00:22:43 +09:00
parent a04faa7001
commit b232279c25

View File

@ -3,6 +3,7 @@
namespace App\MetadataResolver; namespace App\MetadataResolver;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use Symfony\Component\DomCrawler\Crawler; use Symfony\Component\DomCrawler\Crawler;
class FanzaResolver implements Resolver class FanzaResolver implements Resolver
@ -43,7 +44,9 @@ class FanzaResolver implements Resolver
public function resolve(string $url): Metadata public function resolve(string $url): Metadata
{ {
$res = $this->client->get($url); $cookieJar = CookieJar::fromArray(['age_check_done' => '1'], 'dmm.co.jp');
$res = $this->client->get($url, ['cookies' => $cookieJar]);
$html = (string) $res->getBody(); $html = (string) $res->getBody();
$crawler = new Crawler($html); $crawler = new Crawler($html);