Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbcc24c49f | ||
|
|
939b059872 |
@@ -21,7 +21,12 @@ class DownloadOptionEvaluator
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false === $this->validateSize($result, $filter)) {
|
||||
// todo: This is arbitrary- revisit in the future
|
||||
//if (false === $this->validateSize($result, $filter)) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if (false === $this->validateDownloadUrl($result->url)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,15 +52,15 @@ class DownloadOptionEvaluator
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if (null !== $filter->codec && in_array($result->codec, $filter->codec)) {
|
||||
if (null !== $filter->codec && !in_array($result->codec, $filter->codec)) {
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if (null !== $filter->quality && in_array($result->quality, $filter->quality)) {
|
||||
if (null !== $filter->quality && !in_array($result->quality, $filter->quality)) {
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if (null !== $filter->provider && in_array($result->provider, $filter->provider)) {
|
||||
if (null !== $filter->provider && !in_array($result->provider, $filter->provider)) {
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
@@ -79,4 +84,18 @@ class DownloadOptionEvaluator
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function validateDownloadUrl(string $downloadUrl)
|
||||
{
|
||||
$badFileLocations = [
|
||||
'https://torrentio.strem.fun/videos/failed_infringement_v2.mp4' => 'Removed for Copyright Infringement.',
|
||||
];
|
||||
|
||||
$headers = get_headers($downloadUrl, true);
|
||||
if (array_key_exists($headers['Location'], $badFileLocations)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user