1
0
Fork 0
forked from blallo/rss-bridge
rss-bridge/bridges/ProjectMGameBridge.php

44 lines
1.2 KiB
PHP
Raw Normal View History

2014-08-27 17:37:38 +02:00
<?php
/**
* 2014-08-27
* @name Project M Game Bridge
* @homepage http://projectmgame.com/en/
* @description Returns the newest articles.
* @maintainer corenting
*/
class ProjectMGameBridge extends BridgeAbstract{
2014-08-27 18:23:43 +02:00
2014-08-27 17:37:38 +02:00
public function collectData(array $param){
$html = '';
$html = file_get_html('http://projectmgame.com/en/') or $this->returnError('Error while downloading the Project M homepage', 404);
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 = '';
2014-08-27 18:23:43 +02:00
foreach($p_list as $p) $content .= $p->innertext;
2014-08-27 17:37:38 +02:00
$item->content = $content;
// get publication date
$str_date = $article->find('section div.info_block a',0)->innertext;
2014-08-27 18:23:43 +02:00
$item->timestamp = strtotime($str_date);
2014-08-27 17:37:38 +02:00
$this->items[] = $item;
}
}
public function getName(){
return 'Project M Game Bridge';
}
public function getURI(){
return 'http://projectmgame.com/en/';
}
public function getCacheDuration(){
2014-08-27 18:23:43 +02:00
return 10800; //3 hours
2014-08-27 17:37:38 +02:00
}
}