2019-01-13 19:12:31 +01:00
|
|
|
<?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 getIcon()
|
|
|
|
{
|
|
|
|
return 'https://n26.com/favicon.ico';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function collectData()
|
|
|
|
{
|
2019-10-03 21:58:57 +02:00
|
|
|
$html = getSimpleHTMLDOM(self::URI . '/en-eu/blog-archive')
|
2019-01-13 19:12:31 +01:00
|
|
|
or returnServerError('Error while downloading the website content');
|
|
|
|
|
2019-10-03 21:58:57 +02:00
|
|
|
foreach($html->find('div[class="ag ah ai aj bs bt dx ea fo gx ie if ih ii ij ik s"]') as $article) {
|
2019-01-13 19:12:31 +01:00
|
|
|
$item = [];
|
|
|
|
|
|
|
|
$item['uri'] = self::URI . $article->find('h2 a', 0)->href;
|
|
|
|
$item['title'] = $article->find('h2 a', 0)->plaintext;
|
|
|
|
|
|
|
|
$fullArticle = getSimpleHTMLDOM($item['uri'])
|
|
|
|
or returnServerError('Error while downloading the full article');
|
|
|
|
|
2019-10-03 21:58:57 +02:00
|
|
|
$dateElement = $fullArticle->find('time', 0);
|
2019-01-13 19:12:31 +01:00
|
|
|
$item['timestamp'] = strtotime($dateElement->plaintext);
|
2019-10-03 21:58:57 +02:00
|
|
|
$item['content'] = $fullArticle->find('div[class="af ag ah ai an"]', 1)->innertext;
|
2019-01-13 19:12:31 +01:00
|
|
|
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|