From b921beffd705a2a35be8489afd39f7b47d1e43c2 Mon Sep 17 00:00:00 2001 From: Qi HU Date: Thu, 18 Dec 2025 13:35:05 +0800 Subject: [PATCH] Enable IYUU PTGen v2.0.0 Signed-off-by: Qi HU --- nexus/PTGen/PTGen.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nexus/PTGen/PTGen.php b/nexus/PTGen/PTGen.php index 8c459456..4b208fbd 100644 --- a/nexus/PTGen/PTGen.php +++ b/nexus/PTGen/PTGen.php @@ -350,9 +350,17 @@ HTML; public function isIyuu(array $bodyArr): bool { - return false; - //Not support, due to change frequently -// return isset($bodyArr['ret']) && $bodyArr['ret'] == 200; + $version = (string)($bodyArr['version'] ?? ''); + switch ($version) { + case '2.0.0': + return isset($bodyArr['ret']) + && intval($bodyArr['ret']) === 200 + && isset($bodyArr['data']['format']) + && is_string($bodyArr['data']['format']) + && $bodyArr['data']['format'] !== ''; + default: + return false; + } } public function listRatings(array $ptGenData, string $imdbLink, string $desc = ''): array @@ -574,6 +582,10 @@ HTML; do_log("$log, site: $site can not be updated: " . $exception->getMessage(), 'error'); } } + if (empty($ptGenInfo)) { + do_log("$log, no pt gen info updated"); + return false; + } $siteIdAndRating = $this->listRatings($ptGenInfo, $torrent->url, $extra->descr); foreach ($siteIdAndRating as $key => $value) { if (!isset($ptGenInfo[$key]['data']) || !is_array($ptGenInfo[$key]['data'])) {