Sfoglia il codice sorgente

[DanbooruBridge] Fix broken URI

This fixes broken URIs in the output data caused by duplicate domain
names caused by sites (descendant class Delbooru) providing absolute
URIs instead of relative ones.

References #552
logmanoriginal 6 anni fa
parent
commit
f6f3a213ef
1 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 5 2
      bridges/DanbooruBridge.php

+ 5 - 2
bridges/DanbooruBridge.php

@@ -31,11 +31,14 @@ class DanbooruBridge extends BridgeAbstract {
 	}
 
 	protected function getItemFromElement($element){
+		// Fix links
+		defaultLinkTo($element, $this->getURI());
+
 		$item = array();
-		$item['uri'] = $this->getURI() . $element->find('a', 0)->href;
+		$item['uri'] = $element->find('a', 0)->href;
 		$item['postid'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE));
 		$item['timestamp'] = time();
-		$thumbnailUri = $this->getURI() . $element->find('img', 0)->src;
+		$thumbnailUri = $element->find('img', 0)->src;
 		$item['tags'] = $element->find('img', 0)->getAttribute('alt');
 		$item['title'] = $this->getName() . ' | ' . $item['postid'];
 		$item['content'] = '<a href="'