diff --git a/bridges/DeutscheWelleBridge.php b/bridges/DeutscheWelleBridge.php index 29b478b9..51214320 100644 --- a/bridges/DeutscheWelleBridge.php +++ b/bridges/DeutscheWelleBridge.php @@ -73,12 +73,12 @@ class DeutscheWelleBridge extends FeedExpander protected function parseItem(array $item) { - $parsedUrl = parse_url($item['uri']); - unset($parsedUrl['query']); - $url = $this->unparseUrl($parsedUrl); + $parsedUri = parse_url($item['uri']); + unset($parsedUri['query']); + $item['uri'] = $this->unparseUrl($parsedUri); - $page = getSimpleHTMLDOM($url); - $page = defaultLinkTo($page, $url); + $page = getSimpleHTMLDOM($item['uri']); + $page = defaultLinkTo($page, $item['uri']); $article = $page->find('article', 0); @@ -112,6 +112,13 @@ class DeutscheWelleBridge extends FeedExpander $img->height = null; } + // remove bad img src's added by defaultLinkTo() above + // these images should have src="" and will then use + // the srcset attribute to load the best image for the displayed size + foreach ($article->find('figure > picture > img') as $img) { + $img->src = ''; + } + // replace lazy-loaded images foreach ($article->find('figure.placeholder-image') as $figure) { $img = $figure->find('img', 0);