2015-07-03 18:43:15 +02:00
|
|
|
<?php
|
2016-09-04 13:28:55 +02:00
|
|
|
class TheOatmealBridge extends FeedExpander{
|
2015-07-03 18:43:15 +02:00
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const MAINTAINER = "Riduidel";
|
|
|
|
const NAME = "The Oatmeal";
|
|
|
|
const URI = "http://theoatmeal.com/";
|
|
|
|
const DESCRIPTION = "Un petit site de dessins assez rigolos";
|
2015-11-05 12:20:11 +01:00
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
2016-08-29 23:26:32 +02:00
|
|
|
$this->collectExpandableDatas('http://feeds.feedburner.com/oatmealfeed');
|
2015-07-03 18:43:15 +02:00
|
|
|
}
|
2015-07-05 15:24:06 +02:00
|
|
|
|
2016-09-04 13:26:40 +02:00
|
|
|
protected function parseItem($newsItem) {
|
2016-09-04 13:17:28 +02:00
|
|
|
$item = $this->parseRSS_1_0_Item($newsItem);
|
2015-07-03 18:43:15 +02:00
|
|
|
|
2016-09-10 19:11:09 +02:00
|
|
|
$articlePage = $this->getSimpleHTMLDOMCached($item['uri']);
|
2015-07-03 18:43:15 +02:00
|
|
|
$content = $articlePage->find('#comic', 0);
|
2016-09-04 13:17:28 +02:00
|
|
|
if(is_null($content)) // load alternative
|
|
|
|
$content = $articlePage->find('#blog', 0);
|
|
|
|
|
|
|
|
if(!is_null($content))
|
|
|
|
$item['content'] = $content->innertext;
|
2016-08-25 17:11:49 +02:00
|
|
|
|
2015-07-03 18:43:15 +02:00
|
|
|
return $item;
|
|
|
|
}
|
2016-08-25 17:11:49 +02:00
|
|
|
|
2015-07-03 18:43:15 +02:00
|
|
|
public function getCacheDuration(){
|
2015-07-05 15:27:39 +02:00
|
|
|
return 7200; // 2h hours
|
2015-07-03 18:43:15 +02:00
|
|
|
}
|
|
|
|
}
|