Merge pull request #468 from shikorism/feature/per-host-resolve-control

リモートホストごとの同時アクセス制御とメタデータ取得ポリシー制御
This commit is contained in:
shibafu authored and GitHub committed 2020-08-22 09:37:09 +09:00
commit 301fc83e7e
9 files changed
+465 -67

No files matched your search

@@ -0,0 +1,30 @@
<?php
namespace App\MetadataResolver;
use RuntimeException;
use Throwable;
/**
* ContentProviderの提供するrobots.txtによってクロールが拒否された場合にスローされます。
*/
class DisallowedByProviderException extends RuntimeException
{
private $url;
public function __construct(string $url, Throwable $previous = null)
{
parent::__construct("Access denied by robots.txt: $url", 0, $previous);
$this->url = $url;
}
public function getUrl(): string
{
return $this->url;
}
public function getHost(): string
{
return parse_url($this->url, PHP_URL_HOST);
}
}