[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
This commit is contained in:
sysadminstory 2018-10-15 18:23:08 +02:00 committed by LogMANOriginal
parent 9a3c776096
commit d89c65d219

View file

@ -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;