2014-08-27 17:37:38 +02:00
|
|
|
<?php
|
|
|
|
class ProjectMGameBridge extends BridgeAbstract{
|
2014-08-27 18:23:43 +02:00
|
|
|
|
2016-08-30 11:23:55 +02:00
|
|
|
const MAINTAINER = "corenting";
|
|
|
|
const NAME = "Project M Game Bridge";
|
|
|
|
const URI = "http://projectmgame.com/en/";
|
|
|
|
const DESCRIPTION = "Returns the newest articles.";
|
2015-11-04 10:47:21 +01:00
|
|
|
|
|
|
|
|
2016-08-25 01:24:53 +02:00
|
|
|
public function collectData(){
|
2016-08-30 11:23:55 +02:00
|
|
|
$html = $this->getSimpleHTMLDOM(self::URI)
|
2016-08-29 21:54:25 +02:00
|
|
|
or $this->returnServerError('Error while downloading the Project M homepage');
|
2014-08-27 17:37:38 +02:00
|
|
|
|
|
|
|
foreach($html->find('article') as $article) {
|
2016-08-22 18:55:59 +02:00
|
|
|
$item = array();
|
2016-08-30 11:23:55 +02:00
|
|
|
$item['uri'] = self::URI.$article->find('section div.info_block a',0)->href;
|
2016-08-22 18:55:59 +02:00
|
|
|
$item['title'] = $article->find('h1 p',0)->innertext;
|
2014-08-27 17:37:38 +02:00
|
|
|
|
|
|
|
$p_list = $article->find('section p');
|
|
|
|
$content = '';
|
2014-08-27 18:23:43 +02:00
|
|
|
foreach($p_list as $p) $content .= $p->innertext;
|
2016-08-22 18:55:59 +02:00
|
|
|
$item['content'] = $content;
|
2014-08-27 17:37:38 +02:00
|
|
|
|
|
|
|
// get publication date
|
|
|
|
$str_date = $article->find('section div.info_block a',0)->innertext;
|
2016-08-22 18:55:59 +02:00
|
|
|
$item['timestamp'] = strtotime($str_date);
|
2014-08-27 17:37:38 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCacheDuration(){
|
2014-08-27 18:23:43 +02:00
|
|
|
return 10800; //3 hours
|
2014-08-27 17:37:38 +02:00
|
|
|
}
|
|
|
|
}
|