mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-23 15:06:53 +00:00
Merge 65b044b84d
into 1e40d6f492
This commit is contained in:
commit
94307ab8cf
39
bridges/MalikiBridge.php
Normal file
39
bridges/MalikiBridge.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* RssBridgeMaliki
|
||||
* Returns Maliki's strips from previous weeks (20 items)
|
||||
*
|
||||
* @name Maliki
|
||||
* @description Returns Maliki's strips from previous weeks (20 items)
|
||||
*/
|
||||
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;
|
||||
foreach($html->find('div.boite_strip') as $element) {
|
||||
if(!empty($element->find('a',0)->href) and $count < 20) {
|
||||
$item = new \Item();
|
||||
$item->uri = 'http://www.maliki.com/'.$element->find('a',0)->href;
|
||||
$item->thumbnailUri = 'http://www.maliki.com/'.$element->find('img',0)->src;
|
||||
$item->title = $element->find('img',0)->title;
|
||||
$item->timestamp = strtotime(str_replace('/', '-', $element->find('span.stylepetit', 0)->innertext));
|
||||
$item->content = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a>';
|
||||
$this->items[] = $item;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return 'Maliki';
|
||||
}
|
||||
|
||||
public function getURI(){
|
||||
return 'http://www.maliki.com/';
|
||||
}
|
||||
|
||||
public function getCacheDuration(){
|
||||
return 86400; // 24 hours
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ TODO :
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
error_reporting(0);
|
||||
ini_set('user_agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:20.0; RSS-Bridge; +https://github.com/sebsauvage/rss-bridge/) Gecko/20100101 Firefox/20.0');
|
||||
//ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only.
|
||||
|
||||
try{
|
||||
@ -32,9 +33,6 @@ try{
|
||||
$format = $_REQUEST['format'];
|
||||
unset($_REQUEST['format']);
|
||||
|
||||
// FIXME : necessary ?
|
||||
// ini_set('user_agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0');
|
||||
|
||||
$cache = Cache::create('FileCache');
|
||||
|
||||
// Data retrieval
|
||||
@ -135,4 +133,4 @@ $formats = Format::searchInformation();
|
||||
<a href="https://github.com/sebsauvage/rss-bridge">RSS-Bridge</a> alpha 0.1
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user