[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
This commit is contained in:
logmanoriginal 2017-07-25 14:40:34 +02:00
parent 1faa91ef0f
commit f6f3a213ef

View file

@ -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="'