[PikabuBridge] Preserve links (#1286)

* [PikabuBridge] Preserve links
This commit is contained in:
Eugene Molotov 2019-09-17 00:28:41 +05:00 committed by Lyra
parent 1daef22a3d
commit 7f6ca23e8f
1 changed files with 8 additions and 1 deletions

View File

@ -110,6 +110,10 @@ class PikabuBridge extends BridgeAbstract {
} }
} }
$img->outertext = '<img src="' . $src . '">'; $img->outertext = '<img src="' . $src . '">';
// it is assumed, that img's parents are links to post itself
// we don't need them
$img->parent()->outertext = $img->outertext;
} }
$categories = array(); $categories = array();
@ -125,7 +129,10 @@ class PikabuBridge extends BridgeAbstract {
$item['categories'] = $categories; $item['categories'] = $categories;
$item['author'] = $post->find('.user__nick', 0)->innertext; $item['author'] = $post->find('.user__nick', 0)->innertext;
$item['title'] = $title->plaintext; $item['title'] = $title->plaintext;
$item['content'] = strip_tags(backgroundToImg($post->find('.story__content-inner', 0)->innertext), '<br><p><img>'); $item['content'] = strip_tags(
backgroundToImg($post->find('.story__content-inner', 0)->innertext),
'<br><p><img><a>
');
$item['uri'] = $title->href; $item['uri'] = $title->href;
$item['timestamp'] = strtotime($time->getAttribute('datetime')); $item['timestamp'] = strtotime($time->getAttribute('datetime'));
$this->items[] = $item; $this->items[] = $item;