1
0
Derivar 1
rss-bridge/bridges/TheOatMealBridge.php
Pierre Mazière f1fb95b257 [core] extract BridgeAbstract methods to make them functions
- returnError, returnServerError, returnClientError ,debugMessage are
  moved to lib/error.php

- getContents, getSimpleHTMLDOM, getSimpleHTMLDOMCached are moved to
  lib/contents.php

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-09-25 23:22:33 +02:00

30 linhas
846 B
PHP

<?php
class TheOatmealBridge extends FeedExpander{
const MAINTAINER = "Riduidel";
const NAME = "The Oatmeal";
const URI = "http://theoatmeal.com/";
const DESCRIPTION = "Un petit site de dessins assez rigolos";
public function collectData(){
$this->collectExpandableDatas('http://feeds.feedburner.com/oatmealfeed');
}
protected function parseItem($newsItem) {
$item = parent::parseItem($newsItem);
$articlePage = getSimpleHTMLDOMCached($item['uri']);
$content = $articlePage->find('#comic', 0);
if(is_null($content)) // load alternative
$content = $articlePage->find('#blog', 0);
if(!is_null($content))
$item['content'] = $content->innertext;
return $item;
}
public function getCacheDuration(){
return 7200; // 2h hours
}
}