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 { . '
';