[T411] Cleanup advertisments
This commit is contained in:
parent
980075c8f9
commit
5353697e67
1 changed files with 17 additions and 9 deletions
|
@ -3,11 +3,11 @@ class T411Bridge extends BridgeAbstract {
|
||||||
|
|
||||||
public function loadMetadatas() {
|
public function loadMetadatas() {
|
||||||
|
|
||||||
$this->maintainer = "ORelio";
|
$this->maintainer = 'ORelio';
|
||||||
$this->name = "T411";
|
$this->name = 'T411';
|
||||||
$this->uri = $this->getURI();
|
$this->uri = $this->getURI();
|
||||||
$this->description = "Returns the 5 newest torrents with specified search terms <br /> Use url part after '?' mark when using their search engine";
|
$this->description = 'Returns the 10 newest torrents with specified search terms <br /> Use url part after "?" mark when using their search engine.';
|
||||||
$this->update = "2016-02-06";
|
$this->update = '2016-06-25';
|
||||||
|
|
||||||
$this->parameters[] =
|
$this->parameters[] =
|
||||||
'[
|
'[
|
||||||
|
@ -45,8 +45,8 @@ class T411Bridge extends BridgeAbstract {
|
||||||
//Process each item individually
|
//Process each item individually
|
||||||
foreach ($results->find('tr') as $element) {
|
foreach ($results->find('tr') as $element) {
|
||||||
|
|
||||||
//Limit total amount of requests
|
//Limit total amount of requests and ignore table header
|
||||||
if ($limit < 10) {
|
if ($limit < 10 && !is_object($element->find('th', 0))) {
|
||||||
|
|
||||||
//Requests are rate-limited
|
//Requests are rate-limited
|
||||||
usleep(500000); //So we need to wait (500ms)
|
usleep(500000); //So we need to wait (500ms)
|
||||||
|
@ -66,12 +66,20 @@ class T411Bridge extends BridgeAbstract {
|
||||||
//Retrieve image for thumbnail or generic logo fallback
|
//Retrieve image for thumbnail or generic logo fallback
|
||||||
$item_image = $this->getURI().'themes/blue/images/logo.png';
|
$item_image = $this->getURI().'themes/blue/images/logo.png';
|
||||||
foreach ($item_desc->find('img') as $img) {
|
foreach ($item_desc->find('img') as $img) {
|
||||||
if (strpos($img->src, 'prez') === false) {
|
if (strpos($img->src, 'prez') === false && strpos($img->src, '/ad/') === false) {
|
||||||
$item_image = $img->src;
|
$item_image = $img->src;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Cleanup advertisments
|
||||||
|
$divs = explode('<div class="align-center">', $item_desc->innertext);
|
||||||
|
$item_desc = '';
|
||||||
|
foreach ($divs as $text)
|
||||||
|
if (strpos($text, 'adprovider.adlure.net') === false)
|
||||||
|
$item_desc = $item_desc.'<div class="align-center">'.$text;
|
||||||
|
$item_desc = preg_replace('/<h2 class="align-center">LIENS DE T..?L..?CHARGEMENT<\/h2>/i', '', $item_desc);
|
||||||
|
|
||||||
//Build and add final item
|
//Build and add final item
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = $item_uri;
|
$item->uri = $item_uri;
|
||||||
|
@ -79,7 +87,7 @@ class T411Bridge extends BridgeAbstract {
|
||||||
$item->author = $item_author;
|
$item->author = $item_author;
|
||||||
$item->timestamp = $item_date;
|
$item->timestamp = $item_date;
|
||||||
$item->thumbnailUri = $item_image;
|
$item->thumbnailUri = $item_image;
|
||||||
$item->content = $item_desc->innertext;
|
$item->content = $item_desc;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
$limit++;
|
$limit++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue