From 811e8d8c88925dd7c745861420dbeb74079acc0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20T?= Date: Sat, 15 Sep 2018 17:11:36 +0200 Subject: [PATCH] [ETTVBridge] Improvements and bug fixes (#682) * Fix typo with status field * Comply with other bridges Change the uri element of an item to point, not on the magnet link, but on the page, as similar bridges do. * Improved to return name & uri matching with query This change makes it possible for the feed reader to discover a title and url consistent with the user's search. --- bridges/ETTVBridge.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/bridges/ETTVBridge.php b/bridges/ETTVBridge.php index ab90bf7f..b5137550 100644 --- a/bridges/ETTVBridge.php +++ b/bridges/ETTVBridge.php @@ -94,17 +94,20 @@ class ETTVBridge extends BridgeAbstract { ) )); + protected $results_link; + public function collectData(){ - // No control on inputs, because all have defaultValue set + // No control on inputs, because all defaultValue are set $query_str = 'torrents-search.php'; $query_str .= '?search=' . urlencode('+'.str_replace(' ', ' +', $this->getInput('query'))); $query_str .= '&cat=' . $this->getInput('cat'); - $query_str .= 'incldead&=' . $this->getInput('status'); + $query_str .= '&incldead=' . $this->getInput('status'); $query_str .= '&lang=' . $this->getInput('lang'); $query_str .= '&sort=id&order=desc'; // Get results page - $html = getSimpleHTMLDOM(self::URI . $query_str) + $this->results_link = self::URI . $query_str; + $html = getSimpleHTMLDOM($this->results_link) or returnServerError('Could not request ' . $this->getName()); // Loop on each entry @@ -125,7 +128,7 @@ class ETTVBridge extends BridgeAbstract { $item = array(); $item['author'] = $details->children(6)->children(1)->plaintext; $item['title'] = $entry->title; - $item['uri'] = $dllinks->children(0)->children(0)->children(0)->href; + $item['uri'] = $link; $item['timestamp'] = strtotime($details->children(7)->children(1)->plaintext); $item['content'] = ''; $item['content'] .= '
Name: ' . $details->children(0)->children(1)->innertext; @@ -139,4 +142,20 @@ class ETTVBridge extends BridgeAbstract { $this->items[] = $item; } } + + public function getName(){ + if($this->getInput('query')) { + return '[' . self::NAME . '] ' . $this->getInput('query'); + } + + return self::NAME; + } + + public function getURI(){ + if(isset($this->results_link) && !empty($this->results_link)) { + return $this->results_link; + } + + return self::URI; + } }