Merge pull request #430 from shikorism/fix/429-fanza-cookie
FANZA: 年齢認証Cookieを送信する
This commit is contained in:
commit
d83516f394
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user