2014-05-26 02:30:46 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* RssBridgeMaliki
|
2014-05-30 19:53:48 +04:00
|
|
|
* Returns Maliki's newest strips
|
2014-05-26 02:30:46 +04:00
|
|
|
*
|
|
|
|
* @name Maliki
|
|
|
|
* @homepage http://www.maliki.com/
|
2014-05-30 19:53:48 +04:00
|
|
|
* @description Returns Maliki's newest strips
|
2014-05-26 02:30:46 +04:00
|
|
|
* @maintainer mitsukarenai
|
2014-05-30 19:53:48 +04:00
|
|
|
* @update 2014-05-30
|
2014-05-26 02:30:46 +04:00
|
|
|
*/
|
|
|
|
class MalikiBridge extends BridgeAbstract{
|
|
|
|
|
|
|
|
public function collectData(array $param){
|
|
|
|
$html = file_get_html('http://www.maliki.com/') or $this->returnError('Could not request Maliki.', 404);
|
|
|
|
$count=0;
|
2014-05-30 19:53:48 +04:00
|
|
|
$latest=1; $latest_title="";
|
|
|
|
$latest = $html->find('div.conteneur_page a', 1)->href;
|
|
|
|
$latest_title = $html->find('div.conteneur_page img', 0)->title;
|
|
|
|
|
|
|
|
function MalikiExtractContent($url) {
|
|
|
|
$html2 = file_get_html($url);
|
|
|
|
$text = 'http://www.maliki.com/'.$html2->find('img', 0)->src;
|
|
|
|
$text = '<img alt="" src="'.$text.'"/><br>'.$html2->find('div.imageetnews', 0)->plaintext;
|
|
|
|
return $text;
|
|
|
|
}
|
|
|
|
|
|
|
|
$item = new \Item();
|
|
|
|
$item->uri = 'http://www.maliki.com/'.$latest;
|
|
|
|
$item->title = $latest_title;
|
|
|
|
$item->timestamp = time();
|
|
|
|
$item->content = MalikiExtractContent($item->uri);
|
|
|
|
$this->items[] = $item;
|
|
|
|
|
|
|
|
|
2014-05-26 02:30:46 +04:00
|
|
|
foreach($html->find('div.boite_strip') as $element) {
|
2014-05-30 19:53:48 +04:00
|
|
|
if(!empty($element->find('a',0)->href) and $count < 3) {
|
2014-05-26 02:30:46 +04:00
|
|
|
$item = new \Item();
|
|
|
|
$item->uri = 'http://www.maliki.com/'.$element->find('a',0)->href;
|
|
|
|
$item->title = $element->find('img',0)->title;
|
|
|
|
$item->timestamp = strtotime(str_replace('/', '-', $element->find('span.stylepetit', 0)->innertext));
|
2014-05-30 19:53:48 +04:00
|
|
|
$item->content = MalikiExtractContent($item->uri);
|
2014-05-26 02:30:46 +04:00
|
|
|
$this->items[] = $item;
|
|
|
|
$count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName(){
|
|
|
|
return 'Maliki';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getURI(){
|
|
|
|
return 'http://www.maliki.com/';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
2014-05-30 19:53:48 +04:00
|
|
|
return 86400*6; // 6 days
|
2014-05-26 02:30:46 +04:00
|
|
|
}
|
|
|
|
}
|