mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2024-11-22 09:35:28 +03:00
[N26] fix: broken css selectors (#2639)
This commit is contained in:
parent
9e2e32a19d
commit
b6e8e3ea6e
1 changed files with 28 additions and 20 deletions
|
@ -8,28 +8,36 @@ class N26Bridge extends BridgeAbstract
|
|||
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 = array();
|
||||
|
||||
$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';
|
||||
}
|
||||
|
||||
public function collectData()
|
||||
{
|
||||
$html = getSimpleHTMLDOM(self::URI . '/en-eu/blog-archive');
|
||||
|
||||
foreach($html->find('div[class="ag ah ai aj bs bt dx ea fo gx ie if ih ii ij ik s"]') as $article) {
|
||||
$item = array();
|
||||
|
||||
$item['uri'] = self::URI . $article->find('h2 a', 0)->href;
|
||||
$item['title'] = $article->find('h2 a', 0)->plaintext;
|
||||
|
||||
$fullArticle = getSimpleHTMLDOM($item['uri']);
|
||||
|
||||
$dateElement = $fullArticle->find('time', 0);
|
||||
$item['timestamp'] = strtotime($dateElement->plaintext);
|
||||
$item['content'] = $fullArticle->find('div[class="af ag ah ai an"]', 1)->innertext;
|
||||
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue