diff --git a/bridges/DagensNyheterDirektBridge.php b/bridges/DagensNyheterDirektBridge.php index 2918b2b464d..ebba818d4d3 100644 --- a/bridges/DagensNyheterDirektBridge.php +++ b/bridges/DagensNyheterDirektBridge.php @@ -2,12 +2,12 @@ class DagensNyheterDirektBridge extends BridgeAbstract { - const NAME = 'Dagens Nyheter Direkt'; - const URI = 'https://www.dn.se/direkt/'; - const BASEURL = 'https://www.dn.se'; - const DESCRIPTION = 'Latest news summarised by Dagens Nyheter'; - const MAINTAINER = 'ajain-93'; - const LIMIT = 20; + const NAME = 'Dagens Nyheter Direkt'; + const URI = 'https://www.dn.se/direkt/'; + const BASEURL = 'https://www.dn.se'; + const DESCRIPTION = 'Latest news summarised by Dagens Nyheter'; + const MAINTAINER = 'ajain-93'; + const LIMIT = 20; public function getIcon(){ return 'https://cdn.dn-static.se/images/favicon__c2dd3284b46ffdf4d520536e526065fa8.svg'; @@ -15,15 +15,13 @@ public function getIcon(){ public function collectData() { - $NEWSURL = self::BASEURL . '/ajax/direkt/'; - $html = getSimpleHTMLDOM($NEWSURL) - or returnServerError('Could not request: ' . $NEWSURL); + $html = getSimpleHTMLDOM($NEWSURL) or + returnServerError('Could not request: ' . $NEWSURL); foreach ($html->find('article') as $element) { - $link = $element->find('button', 0)->getAttribute('data-link'); $datetime = $element->getAttribute('data-publication-time'); $url = self::BASEURL . $link; @@ -44,8 +42,7 @@ public function collectData() $article_html = $figure->find('img', 0) . '
' . $figure->find('figcaption', 0) . '
'; } - foreach ($article_content->find('p') as $p) - { + foreach ($article_content->find('p') as $p) { $article_html = $article_html . $p; } @@ -57,8 +54,7 @@ public function collectData() 'content' => trim($article_html), ]; - if (count($this->items) > self::LIMIT) - { + if (count($this->items) > self::LIMIT) { break; } }