rss-bridge/bridges/ProjectMGameBridge.php

35 lines
1.1 KiB
PHP
Raw Normal View History

2014-08-27 19:37:38 +04:00
<?php
class ProjectMGameBridge extends BridgeAbstract{
2014-08-27 20:23:43 +04:00
public $maintainer = "corenting";
public $name = "Project M Game Bridge";
public $uri = "http://projectmgame.com/en/";
public $description = "Returns the newest articles.";
2015-11-04 12:47:21 +03:00
public function collectData(){
2014-08-27 19:37:38 +04:00
$html = '';
$html = $this->getSimpleHTMLDOM('http://projectmgame.com/en/') or $this->returnServerError('Error while downloading the Project M homepage');
2014-08-27 19:37:38 +04:00
foreach($html->find('article') as $article) {
$item = array();
$item['uri'] = 'http://projectmgame.com/en/'.$article->find('section div.info_block a',0)->href;
$item['title'] = $article->find('h1 p',0)->innertext;
2014-08-27 19:37:38 +04:00
$p_list = $article->find('section p');
$content = '';
2014-08-27 20:23:43 +04:00
foreach($p_list as $p) $content .= $p->innertext;
$item['content'] = $content;
2014-08-27 19:37:38 +04:00
// get publication date
$str_date = $article->find('section div.info_block a',0)->innertext;
$item['timestamp'] = strtotime($str_date);
2014-08-27 19:37:38 +04:00
$this->items[] = $item;
}
}
public function getCacheDuration(){
2014-08-27 20:23:43 +04:00
return 10800; //3 hours
2014-08-27 19:37:38 +04:00
}
}