From 2bb99c444817af322594344d667c06e15d528191 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 18 Sep 2020 07:13:31 +0200 Subject: [PATCH] [NordbayernBridge] Fix images and newsblock order (#1741) --- bridges/NordbayernBridge.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bridges/NordbayernBridge.php b/bridges/NordbayernBridge.php index a7ae72e3..ecc93c9d 100644 --- a/bridges/NordbayernBridge.php +++ b/bridges/NordbayernBridge.php @@ -48,12 +48,11 @@ class NordbayernBridge extends BridgeAbstract { )); private function getImageUrlFromScript($script) { - preg_match("#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9_]*\\.jpg)#", $script->innertext, $matches, PREG_OFFSET_CAPTURE); + preg_match("#src=\\\\'(https:[-:\\.\\\\/a-zA-Z0-9%_]*\\.(jpg|JPG))#", $script->innertext, $matches, PREG_OFFSET_CAPTURE); if(isset($matches[1][0])) { return stripcslashes($matches[1][0]) . '?w=800'; - } else { - return null; } + return null; } private function handleArticle($link) { @@ -105,16 +104,16 @@ class NordbayernBridge extends BridgeAbstract { private function handleNewsblock($listSite, $readPoliceReports) { $newsBlocks = $listSite->find('section[class*=newsblock]'); - $policeBlock = $newsBlocks[0]; - $regionalNewsBlock = $newsBlocks[1]; + $regionalNewsBlock = $newsBlocks[0]; + $policeBlock = $newsBlocks[1]; + foreach($regionalNewsBlock->find('h2') as $headline) { + self::handleArticle(self::URI . $headline->find('a', 0)->href); + } if($readPoliceReports === true) { foreach($policeBlock->find('h2') as $headline) { self::handleArticle(self::URI . $headline->find('a', 0)->href); } } - foreach($regionalNewsBlock->find('h2') as $headline) { - self::handleArticle(self::URI . $headline->find('a', 0)->href); - } } public function collectData() {