mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-23 15:06:53 +00:00
Update BastaBridge.php
This commit is contained in:
parent
04fe9df3a4
commit
654985cc8c
@ -11,11 +11,7 @@ class BastaBridge extends BridgeAbstract{
|
|||||||
|
|
||||||
public function collectData(array $param){
|
public function collectData(array $param){
|
||||||
|
|
||||||
function BastaStripCDATA($string) {
|
|
||||||
$string = str_replace('<![CDATA[', '', $string);
|
|
||||||
$string = str_replace(']]>', '', $string);
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
function BastaExtractContent($url) {
|
function BastaExtractContent($url) {
|
||||||
$html2 = file_get_html($url);
|
$html2 = file_get_html($url);
|
||||||
$text = $html2->find('div.texte', 0)->innertext;
|
$text = $html2->find('div.texte', 0)->innertext;
|
||||||
@ -27,8 +23,8 @@ class BastaBridge extends BridgeAbstract{
|
|||||||
foreach($html->find('item') as $element) {
|
foreach($html->find('item') as $element) {
|
||||||
if($limit < 10) {
|
if($limit < 10) {
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->title = BastaStripCDATA($element->find('title', 0)->innertext);
|
$item->title = $element->find('title', 0)->innertext;
|
||||||
$item->uri = BastaStripCDATA($element->find('guid', 0)->plaintext);
|
$item->uri = $element->find('guid', 0)->plaintext;
|
||||||
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
|
$item->timestamp = strtotime($element->find('pubDate', 0)->plaintext);
|
||||||
$item->content = BastaExtractContent($item->uri);
|
$item->content = BastaExtractContent($item->uri);
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
@ -48,5 +44,6 @@ class BastaBridge extends BridgeAbstract{
|
|||||||
|
|
||||||
public function getCacheDuration(){
|
public function getCacheDuration(){
|
||||||
return 3600*2; // 2 hours
|
return 3600*2; // 2 hours
|
||||||
|
// return 0; // 2 hours
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user