[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.
This commit is contained in:
parent
adc6f72e97
commit
811e8d8c88
1 changed files with 23 additions and 4 deletions
|
@ -94,17 +94,20 @@ class ETTVBridge extends BridgeAbstract {
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
protected $results_link;
|
||||||
|
|
||||||
public function collectData(){
|
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 = 'torrents-search.php';
|
||||||
$query_str .= '?search=' . urlencode('+'.str_replace(' ', ' +', $this->getInput('query')));
|
$query_str .= '?search=' . urlencode('+'.str_replace(' ', ' +', $this->getInput('query')));
|
||||||
$query_str .= '&cat=' . $this->getInput('cat');
|
$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 .= '&lang=' . $this->getInput('lang');
|
||||||
$query_str .= '&sort=id&order=desc';
|
$query_str .= '&sort=id&order=desc';
|
||||||
|
|
||||||
// Get results page
|
// 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());
|
or returnServerError('Could not request ' . $this->getName());
|
||||||
|
|
||||||
// Loop on each entry
|
// Loop on each entry
|
||||||
|
@ -125,7 +128,7 @@ class ETTVBridge extends BridgeAbstract {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item['author'] = $details->children(6)->children(1)->plaintext;
|
$item['author'] = $details->children(6)->children(1)->plaintext;
|
||||||
$item['title'] = $entry->title;
|
$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['timestamp'] = strtotime($details->children(7)->children(1)->plaintext);
|
||||||
$item['content'] = '';
|
$item['content'] = '';
|
||||||
$item['content'] .= '<br/><b>Name: </b>' . $details->children(0)->children(1)->innertext;
|
$item['content'] .= '<br/><b>Name: </b>' . $details->children(0)->children(1)->innertext;
|
||||||
|
@ -139,4 +142,20 @@ class ETTVBridge extends BridgeAbstract {
|
||||||
$this->items[] = $item;
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue