diff --git a/bridges/PicukiBridge.php b/bridges/PicukiBridge.php index 9f9acf6b..e90177ed 100644 --- a/bridges/PicukiBridge.php +++ b/bridges/PicukiBridge.php @@ -40,6 +40,7 @@ class PicukiBridge extends BridgeAbstract public function collectData() { + $re = '#let short_code = "(.*?)";\s*$#m'; $html = getSimpleHTMLDOM($this->getURI()); foreach ($html->find('.box-photos .box-photo') as $element) { @@ -49,6 +50,11 @@ class PicukiBridge extends BridgeAbstract } $url = urljoin(self::URI, $element->find('a', 0)->href); + $html = getSimpleHTMLDOMCached($url); + $sourceUrl = null; + if (preg_match($re, $html, $matches) > 0) { + $sourceUrl = 'https://instagram.com/p/' . $matches[1]; + } $author = trim($element->find('.user-nickname', 0)->plaintext); @@ -77,11 +83,13 @@ class PicukiBridge extends BridgeAbstract 'timestamp' => date_format($date, 'r'), 'title' => strlen($description) > 60 ? mb_substr($description, 0, 57) . '...' : $description, 'thumbnail' => $imageUrl, + 'source' => $sourceUrl, 'enclosures' => [$imageUrl], 'content' => << +{$sourceUrl} {$videoNote}

{$description}

HTML