1
0
Fork 0
forked from blallo/rss-bridge
rss-bridge/bridges/ProjectMGameBridge.php
Pierre Mazière bba216073c [bridges] remove useless 'update' property from all bridges
That's the source code manager job to keep this information
consistent

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
2016-08-21 00:21:41 +02:00

38 lines
1.1 KiB
PHP

<?php
class ProjectMGameBridge extends BridgeAbstract{
public function loadMetadatas() {
$this->maintainer = "corenting";
$this->name = "Project M Game Bridge";
$this->uri = "http://projectmgame.com/en/";
$this->description = "Returns the newest articles.";
}
public function collectData(array $param){
$html = '';
$html = $this->getSimpleHTMLDOM('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage');
foreach($html->find('article') as $article) {
$item = new \Item();
$item->uri = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href;
$item->title = $article->find('h1 p',0)->innertext;
$p_list = $article->find('section p');
$content = '';
foreach($p_list as $p) $content .= $p->innertext;
$item->content = $content;
// get publication date
$str_date = $article->find('section div.info_block a',0)->innertext;
$item->timestamp = strtotime($str_date);
$this->items[] = $item;
}
}
public function getCacheDuration(){
return 10800; //3 hours
}
}