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

33 lines
931 B
PHP
Raw Normal View History

<?php
class NiceMatinBridge extends FeedExpander {
const MAINTAINER = "pit-fgfjiudghdf";
const NAME = "NiceMatin";
const URI = "http://www.nicematin.com/";
const DESCRIPTION = "Returns the 10 newest posts from NiceMatin (full text)";
2015-11-04 10:47:21 +01:00
public function collectData(){
$this->collectExpandableDatas(self::URI . 'derniere-minute/rss', 10);
}
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
$item['content'] = $this->NiceMatinExtractContent($item['uri']);
return $item;
}
private function NiceMatinExtractContent($url) {
$html = getSimpleHTMLDOMCached($url);
2016-08-03 22:39:03 +02:00
if(!$html)
return 'Could not acquire content from url: ' . $url . '!';
2016-08-03 22:39:03 +02:00
$content = $html->find('article', 0);
if(!$content)
return 'Could not find \'section\'!';
2016-08-03 22:39:03 +02:00
$text = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $content->innertext);
$text = strip_tags($text, '<p><a><img>');
return $text;
2015-11-04 10:47:21 +01:00
}
2016-08-03 22:39:03 +02:00
}