[NordbayernBridge] Fix images and newsblock order (#1741)
This commit is contained in:
parent
3a29347e60
commit
2bb99c4448
1 changed files with 7 additions and 8 deletions
|
@ -48,12 +48,11 @@ class NordbayernBridge extends BridgeAbstract {
|
||||||
));
|
));
|
||||||
|
|
||||||
private function getImageUrlFromScript($script) {
|
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])) {
|
if(isset($matches[1][0])) {
|
||||||
return stripcslashes($matches[1][0]) . '?w=800';
|
return stripcslashes($matches[1][0]) . '?w=800';
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handleArticle($link) {
|
private function handleArticle($link) {
|
||||||
|
@ -105,16 +104,16 @@ class NordbayernBridge extends BridgeAbstract {
|
||||||
|
|
||||||
private function handleNewsblock($listSite, $readPoliceReports) {
|
private function handleNewsblock($listSite, $readPoliceReports) {
|
||||||
$newsBlocks = $listSite->find('section[class*=newsblock]');
|
$newsBlocks = $listSite->find('section[class*=newsblock]');
|
||||||
$policeBlock = $newsBlocks[0];
|
$regionalNewsBlock = $newsBlocks[0];
|
||||||
$regionalNewsBlock = $newsBlocks[1];
|
$policeBlock = $newsBlocks[1];
|
||||||
|
foreach($regionalNewsBlock->find('h2') as $headline) {
|
||||||
|
self::handleArticle(self::URI . $headline->find('a', 0)->href);
|
||||||
|
}
|
||||||
if($readPoliceReports === true) {
|
if($readPoliceReports === true) {
|
||||||
foreach($policeBlock->find('h2') as $headline) {
|
foreach($policeBlock->find('h2') as $headline) {
|
||||||
self::handleArticle(self::URI . $headline->find('a', 0)->href);
|
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() {
|
public function collectData() {
|
||||||
|
|
Loading…
Reference in a new issue