From d89c65d219337995d46295484e3b6c4c543fcee4 Mon Sep 17 00:00:00 2001 From: sysadminstory <sysadminstory@users.noreply.github.com> Date: Mon, 15 Oct 2018 18:23:08 +0200 Subject: [PATCH] [ZoneTelechargementBridge] Update the base URL and make URI unique (#853) - Base URL updated - Show name has different styles on the Website, use another way to get the show name - Entry URIs are now unique to make sure RSS readers don't treat episodes as duplicates - No more new lines in the feed or item title --- bridges/ZoneTelechargementBridge.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bridges/ZoneTelechargementBridge.php b/bridges/ZoneTelechargementBridge.php index 4a53c53a..81539633 100644 --- a/bridges/ZoneTelechargementBridge.php +++ b/bridges/ZoneTelechargementBridge.php @@ -1,7 +1,7 @@ <?php class ZoneTelechargementBridge extends BridgeAbstract { const NAME = 'Zone Telechargement'; - const URI = 'https://ww2.zone-telechargement1.org/'; + const URI = 'https://ww4.zone-telechargement1.org/'; const DESCRIPTION = 'Suivi de série sur Zone Telechargement'; const MAINTAINER = 'sysadminstory'; const PARAMETERS = array( @@ -10,7 +10,7 @@ class ZoneTelechargementBridge extends BridgeAbstract { 'name' => 'URL de la série', 'type' => 'text', 'required' => true, - 'title' => 'URL d\'une série sans le https://ww2.zone-telechargement1.org/', + 'title' => 'URL d\'une série sans le https://ww4.zone-telechargement1.org/', 'exampleValue' => 'telecharger-series/31079-halt-and-catch-fire-saison-4-french-hd720p.html' ) ) @@ -22,8 +22,8 @@ class ZoneTelechargementBridge extends BridgeAbstract { // Get the TV show title $qualityselector = 'div[style=font-size: 18px;margin: 10px auto;color:red;font-weight:bold;text-align:center;]'; - $show = $html->find('div[style*=font-weight: bold;text-align: center;margin: 25px;]', 0)->plaintext; - $quality = explode("\n", $html->find($qualityselector, 0)->plaintext)[0]; + $show = trim($html->find('div[class=smallsep]', 0)->next_sibling()->plaintext); + $quality = trim(explode("\n", $html->find($qualityselector, 0)->plaintext)[0]); $this->showTitle = $show . ' ' . $quality; // Get the post content @@ -47,10 +47,12 @@ class ZoneTelechargementBridge extends BridgeAbstract { // Finally construct the items array foreach($episodes as $epnum => $episode) { $item = array(); - $item['uri'] = self::URI . $this->getInput('url'); // Add every link available in the episode table separated by a <br/> tag $item['content'] = implode('<br/>', $episode); - $item['title'] = $this->showTitle . 'Episode ' . $epnum; + $item['title'] = $this->showTitle . ' Episode ' . $epnum; + // As RSS Bridge use the URI as GUID they need to be unique : adding a md5 hash of the title element + // should geneerate unique URI to prevent confusion for RSS readers + $item['uri'] = self::URI . $this->getInput('url') . '#' . hash('md5', $item['title']); // Insert the episode at the beginning of the item list, to show the newest episode first array_unshift($this->items, $item); } @@ -59,7 +61,7 @@ class ZoneTelechargementBridge extends BridgeAbstract { public function getName(){ switch($this->queriedContext) { case 'Suivre la publication des épisodes d\'une série en cours de diffusion': - return $this->showTitle . ' - ' . self::NAME; + return $this->showTitle . ' - ' . self::NAME; break; default: return self::NAME;