2014-03-26 11:22:53 +01:00
< ? php
/**
*
2015-03-18 17:42:55 +01:00
* @ name Freenews
2015-06-04 17:06:14 +02:00
* @ description Un site d 'actualité pour les freenautes (mais ne parlant pas que de la freebox). Ne rentrez pas d' id si vous voulez accéder aux actualités générales .
2014-03-26 11:22:53 +01:00
* @ update 26 / 03 / 2014
* @ use1 ( id = " Id de la rubrique (sans le '-') " )
*/
2015-03-18 17:42:55 +01:00
require_once 'bridges/RssExpander.php' ;
define ( " RSS " , 'http://feeds.feedburner.com/Freenews-Freebox?format=xml' );
class Freenews extends RssExpander {
2014-03-26 11:22:53 +01:00
public function collectData ( array $param ){
2015-03-18 17:42:55 +01:00
$param [ 'url' ] = RSS ;
parent :: collectData ( $param );
2014-03-26 11:22:53 +01:00
}
2015-03-18 17:42:55 +01:00
protected function parseRSSItem ( $newsItem ) {
$item = new Item ();
$item -> title = trim ( $newsItem -> title );
// $this->message("item has for title \"".$item->title."\"");
if ( empty ( $newsItem -> guid )) {
$item -> uri = $newsItem -> link ;
} else {
$item -> uri = $newsItem -> guid ;
}
// now load that uri from cache
// $this->message("now loading page ".$item->uri);
$articlePage = str_get_html ( $this -> get_cached ( $item -> uri ));
2014-03-26 11:22:53 +01:00
2015-03-18 17:42:55 +01:00
$content = $articlePage -> find ( '.post-container' , 0 );
$item -> content = $content -> innertext ;
$item -> name = $articlePage -> find ( 'a[rel=author]' , 0 ) -> innertext ;
// format should parse 2014-03-25T16:21:20Z. But, according to http://stackoverflow.com/a/10478469, it is not that simple
$item -> timestamp = $this -> RSS_2_0_time_to_timestamp ( $newsItem );
return $item ;
2014-03-26 11:22:53 +01:00
}
}