feat: check EZTV mirrors for available site to query (#3036)

This commit is contained in:
quickwick 2022-09-15 08:47:57 -07:00 committed by GitHub
parent 925caff5dd
commit a1e229a7e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 2 deletions

View File

@ -6,7 +6,7 @@ class EZTVBridge extends BridgeAbstract
{
const MAINTAINER = 'alexAubin';
const NAME = 'EZTV';
const URI = 'https://eztv.re/';
const URI = 'https://eztvstatus.com';
const DESCRIPTION = 'Search for torrents by IMDB id. You can find IMDB id in the url of a tv show.';
const PARAMETERS = [
@ -47,9 +47,11 @@ class EZTVBridge extends BridgeAbstract
public function collectData()
{
$eztv_uri = $this->getEztvUri();
Debug::log($eztv_uri);
$ids = explode(',', trim($this->getInput('ids')));
foreach ($ids as $id) {
$data = json_decode(getContents(sprintf('https://eztv.re/api/get-torrents?imdb_id=%s', $id)));
$data = json_decode(getContents(sprintf('%s/api/get-torrents?imdb_id=%s', $eztv_uri, $id)));
if (!isset($data->torrents)) {
// No results
continue;
@ -79,6 +81,19 @@ class EZTVBridge extends BridgeAbstract
});
}
protected function getEztvUri()
{
$html = getSimpleHTMLDom(self::URI);
$urls = $html->find('a.domainLink');
foreach ($urls as $url) {
$headers = get_headers($url->href);
if (substr($headers[0], 9, 3) === '200') {
return $url->href;
}
}
throw new Exception('No valid EZTV URI available');
}
protected function getItemFromTorrent($torrent)
{
$item = [];