mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 17:45:40 +03:00
4f75591060
Reformat code base to PSR12 Co-authored-by: rssbridge <noreply@github.com>
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
class N26Bridge extends BridgeAbstract
|
|
{
|
|
const MAINTAINER = 'quentinus95';
|
|
const NAME = 'N26 Blog';
|
|
const URI = 'https://n26.com';
|
|
const CACHE_TIMEOUT = 1800;
|
|
const DESCRIPTION = 'Returns recent blog posts from N26.';
|
|
|
|
public function collectData()
|
|
{
|
|
$limit = 5;
|
|
$url = 'https://n26.com/en-eu/blog/all';
|
|
$html = getSimpleHTMLDOM($url);
|
|
|
|
$articles = $html->find('div[class="bl bm"]');
|
|
|
|
foreach ($articles as $article) {
|
|
$item = [];
|
|
|
|
$itemUrl = self::URI . $article->find('a', 1)->href;
|
|
$item['uri'] = $itemUrl;
|
|
|
|
$item['title'] = $article->find('a', 1)->plaintext;
|
|
|
|
$fullArticle = getSimpleHTMLDOM($item['uri']);
|
|
|
|
$createdAt = $fullArticle->find('time', 0);
|
|
$item['timestamp'] = strtotime($createdAt->plaintext);
|
|
|
|
$this->items[] = $item;
|
|
if (count($this->items) >= $limit) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getIcon()
|
|
{
|
|
return 'https://n26.com/favicon.ico';
|
|
}
|
|
}
|