diff --git a/src/Endpoint.php b/src/Endpoint.php index 411981f..f845f18 100644 --- a/src/Endpoint.php +++ b/src/Endpoint.php @@ -104,7 +104,7 @@ class Endpoint { MentionType::Like => "Liked this post", MentionType::Reply => $document->innerText(), MentionType::Repost => "Reposted this post", - MentionType::Mention => $document->closest('a[href="' . $target . '"]')->innerText() + MentionType::Mention => $document->innerText(), }; } @@ -114,9 +114,9 @@ class Endpoint { if ($card) { - $name = $card->filter('.p-name')?->text(); - $url = $card->filter('.u-url')?->text(); - $photo = $card->filter('.u-photo')?->attr('src'); + $name = $card->filter('.p-name')?->text(""); + $url = $card->filter('.u-url')?->text(""); + $photo = $card->filter('.u-photo')->count() ? $card->filter('.u-photo')->attr('src') : ""; return implode(", ", [$name, $url, $photo]); }