mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 09:35:28 +03:00
Create FinanzflussBridge.php (#3282)
* Create finanzflussBridge.php new bridge for finanzfluss.de * Pascal case * Rename finanzflussBridge.php to FinanzflussBridge.php * Update FinanzflussBridge.php more spaces!
This commit is contained in:
parent
180c332406
commit
b40714079f
1 changed files with 50 additions and 0 deletions
50
bridges/FinanzflussBridge.php
Normal file
50
bridges/FinanzflussBridge.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
class FinanzflussBridge extends BridgeAbstract
|
||||
{
|
||||
const MAINTAINER = 'Tone866';
|
||||
const NAME = 'finanzfluss Bridge';
|
||||
const URI = 'https://www.finanzfluss.de/blog';
|
||||
const CACHE_TIMEOUT = 1800; // 30min
|
||||
const DESCRIPTION = 'Feed for finanzfluss';
|
||||
const LIMIT = 10;
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$baseurl = 'https://www.finanzfluss.de';
|
||||
$dom = getSimpleHTMLDOM('https://www.finanzfluss.de/blog');
|
||||
foreach ($dom->find('.preview-card') as $li) {
|
||||
$a = $li->find('a', 0);
|
||||
$title = $a->find('.title', 0);
|
||||
$url = $baseurl . $a->href;
|
||||
|
||||
//get article
|
||||
$domarticle = getSimpleHTMLDOM($url);
|
||||
$content = $domarticle->find('div.content', 0);
|
||||
|
||||
//get header-image and set absolute src
|
||||
$headerimage = $domarticle->find('div.article-header-image', 0);
|
||||
$headerimageimg = $headerimage->find('img[src]', 0);
|
||||
$src = $headerimageimg->src;
|
||||
$headerimageimg->src = $baseurl . $src;
|
||||
$headerimageimg->srcset = $baseurl . $src;
|
||||
|
||||
//set absolute src for all img
|
||||
foreach ($content->find('img[src]') as $img) {
|
||||
$src = $img->src;
|
||||
$img->src = $baseurl . $src;
|
||||
$img->srcset = $baseurl . $src;
|
||||
}
|
||||
|
||||
//get author
|
||||
$author = $domarticle->find('div.author-name', 0);
|
||||
|
||||
$this->items[] = [
|
||||
'title' => $title->plaintext,
|
||||
'uri' => $url,
|
||||
'content' => $headerimage . '<br />' . $content,
|
||||
'author' => $author->plaintext
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue