From 5d188521084ed5693bfbc0c87baa47b63131401e Mon Sep 17 00:00:00 2001 From: Dag Date: Wed, 5 Oct 2022 19:30:42 +0200 Subject: [PATCH] fix: more verbose error in fb (#3089) --- bridges/FacebookBridge.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/bridges/FacebookBridge.php b/bridges/FacebookBridge.php index de7f16d1..a6103919 100644 --- a/bridges/FacebookBridge.php +++ b/bridges/FacebookBridge.php @@ -553,7 +553,8 @@ EOD; $header = []; } - $html = getSimpleHTMLDOM($this->getURI(), $header); + $url = $this->getURI(); + $html = getSimpleHTMLDOM($url, $header); } // Handle captcha form? @@ -571,12 +572,17 @@ EOD; returnServerError('You must be logged in to view this page. This is not supported by RSS-Bridge.'); } - $element = $html - ->find('#pagelet_timeline_main_column')[0] - ->children(0) - ->children(0) - ->next_sibling() - ->children(0); + file_put_contents('/tmp/a.html', "$html"); + $mainColumn = $html->find('#pagelet_timeline_main_column'); + if (!$mainColumn) { + throw new \Exception(sprintf('Unable to find anything useful in %s', $url)); + } + + $element = $mainColumn[0] + ->children(0) + ->children(0) + ->next_sibling() + ->children(0); if (isset($element)) { $author = str_replace(' - Posts | Facebook', '', $html->find('title#pageTitle', 0)->innertext);