Merge pull request #462 from shikorism/fix/454-ogpresolver-cookie

OGPResolver: リダイレクト時にCookieを維持させる
This commit is contained in:
shibafu 2020-08-09 12:35:28 +09:00 committed by GitHub
commit 8093b22981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
namespace App\MetadataResolver;
use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\RequestOptions;
class OGPResolver implements Resolver, Parser
{
@ -18,7 +20,7 @@ class OGPResolver implements Resolver, Parser
public function resolve(string $url): Metadata
{
return $this->parse($this->client->get($url)->getBody());
return $this->parse($this->client->get($url, [RequestOptions::COOKIES => new CookieJar()])->getBody());
}
public function parse(string $html): Metadata