From 0b40f51c01774d6b3ce5c7c9617dd1fbc2201128 Mon Sep 17 00:00:00 2001 From: dag Date: Sun, 10 Apr 2022 18:54:48 +0200 Subject: [PATCH] [Picuki] fix: item parsing (#2619) Fixes a problem with the entire content being a link. Also truncate title. They have referrer checks on their images. So clicking the enclosure doesnt work. Will fix later. --- bridges/PicukiBridge.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bridges/PicukiBridge.php b/bridges/PicukiBridge.php index f3e1f15a..feb5f423 100644 --- a/bridges/PicukiBridge.php +++ b/bridges/PicukiBridge.php @@ -57,19 +57,18 @@ class PicukiBridge extends BridgeAbstract $item['uri'] = urljoin(self::URI, $element->find('a', 0)->href); - $item['title'] = $element->find('.photo-description', 0)->plaintext; + $description = trim($element->find('.photo-description', 0)->plaintext); + $item['title'] = mb_substr($description, 0, 60); $is_video = (bool) $element->find('.video-icon', 0); $item['content'] = ($is_video) ? '(video) ' : ''; - $item['content'] .= $element->find('.photo', 0)->outertext; - - $item['enclosures'] = array( - // just add `.jpg` extension to get the correct mime type. All Instagram posts are JPG - urljoin(self::URI, $element->find('.post-image', 0)->src . '.jpg') - ); - - $item['thumbnail'] = urljoin(self::URI, $element->find('.post-image', 0)->src); + $item['content'] .= $description; + $postImage = $element->find('.post-image', 0)->src; + $item['enclosures'] = [ + urljoin(self::URI, $postImage) + ]; + $item['thumbnail'] = urljoin(self::URI, $postImage); $this->items[] = $item; } }