From 3aae00b56ab3fb44f74962ebce921b812a050c14 Mon Sep 17 00:00:00 2001 From: Clemens Neubauer Date: Wed, 23 Dec 2020 18:19:32 +0100 Subject: [PATCH] [HDWallpapersBridge] Fix URLs (#1892) --- bridges/HDWallpapersBridge.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php index 16c08e75..ffb99425 100644 --- a/bridges/HDWallpapersBridge.php +++ b/bridges/HDWallpapersBridge.php @@ -32,7 +32,7 @@ class HDWallpapersBridge extends BridgeAbstract { $lastpage = 1; for($page = 1; $page <= $lastpage; $page++) { - $link = self::URI . '/' . $category . '/page/' . $page; + $link = self::URI . $category . '/page/' . $page; $html = getSimpleHTMLDOM($link) or returnServerError('No results for this query.'); @@ -41,13 +41,16 @@ class HDWallpapersBridge extends BridgeAbstract { $lastpage = min($matches[1], ceil($max / 14)); } + $html = defaultLinkTo($html, self::URI); + foreach($html->find('.wallpapers .wall a') as $element) { $thumbnail = $element->find('img', 0); + $search = array(self::URI, 'wallpapers.html'); + $replace = array(self::URI . 'download/', $this->getInput('r') . '.jpg'); + $item = array(); - $item['uri'] = self::URI - . '/download' - . str_replace('wallpapers.html', $this->getInput('r') . '.jpg', $element->href); + $item['uri'] = str_replace($search, $replace, $element->href); $item['timestamp'] = time(); $item['title'] = $element->find('em1', 0)->text(); @@ -55,7 +58,6 @@ class HDWallpapersBridge extends BridgeAbstract { . '
';