0
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2024-11-23 07:37:35 +00:00
RSS-Bridge_rss-bridge/bridges/N26Bridge.php
Dag 4f75591060
Reformat codebase v4 (#2872)
Reformat code base to PSR12

Co-authored-by: rssbridge <noreply@github.com>
2022-07-01 15:10:30 +02:00

44 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';
}
}