diff --git a/bridges/AirBreizhBridge.php b/bridges/AirBreizhBridge.php index a822625f..272c74ee 100644 --- a/bridges/AirBreizhBridge.php +++ b/bridges/AirBreizhBridge.php @@ -32,8 +32,7 @@ class AirBreizhBridge extends BridgeAbstract public function collectData() { $html = ''; - $html = getSimpleHTMLDOM(static::URI . 'publications/?fwp_publications_thematiques=' . $this->getInput('theme')) - or returnClientError('No results for this query.'); + $html = getSimpleHTMLDOM(static::URI . 'publications/?fwp_publications_thematiques=' . $this->getInput('theme')); foreach ($html->find('article') as $article) { $item = []; diff --git a/bridges/AmazonPriceTrackerBridge.php b/bridges/AmazonPriceTrackerBridge.php index b07bdb7c..5f93eb49 100644 --- a/bridges/AmazonPriceTrackerBridge.php +++ b/bridges/AmazonPriceTrackerBridge.php @@ -146,7 +146,7 @@ EOT; { $uri = $this->getURI(); - return getSimpleHTMLDOM($uri) ?: returnServerError('Could not request Amazon.'); + return getSimpleHTMLDOM($uri); } private function scrapePriceFromMetrics($html) diff --git a/bridges/AssociatedPressNewsBridge.php b/bridges/AssociatedPressNewsBridge.php index 0f8846eb..db62c826 100644 --- a/bridges/AssociatedPressNewsBridge.php +++ b/bridges/AssociatedPressNewsBridge.php @@ -105,8 +105,7 @@ class AssociatedPressNewsBridge extends BridgeAbstract private function collectCardData() { - $json = getContents($this->getTagURI()) - or returnServerError('Could not request: ' . $this->getTagURI()); + $json = getContents($this->getTagURI()); $tagContents = json_decode($json, true); diff --git a/bridges/BAEBridge.php b/bridges/BAEBridge.php index 6807d548..a0e4c536 100644 --- a/bridges/BAEBridge.php +++ b/bridges/BAEBridge.php @@ -29,7 +29,7 @@ class BAEBridge extends BridgeAbstract public function collectData() { $url = $this->getURI(); - $html = getSimpleHTMLDOM($url) or returnClientError('No results for this query.'); + $html = getSimpleHTMLDOM($url); $annonces = $html->find('main article'); foreach ($annonces as $annonce) { diff --git a/bridges/BandcampDailyBridge.php b/bridges/BandcampDailyBridge.php index 57299a17..1f9a031d 100644 --- a/bridges/BandcampDailyBridge.php +++ b/bridges/BandcampDailyBridge.php @@ -93,8 +93,7 @@ class BandcampDailyBridge extends BridgeAbstract public function collectData() { - $html = getSimpleHTMLDOM($this->getURI()) - or returnServerError('Could not request: ' . $this->getURI()); + $html = getSimpleHTMLDOM($this->getURI()); $html = defaultLinkTo($html, self::URI); @@ -105,8 +104,7 @@ class BandcampDailyBridge extends BridgeAbstract $articlePath = $article->find('a.title', 0)->href; - $articlePageHtml = getSimpleHTMLDOMCached($articlePath, 3600) - or returnServerError('Could not request: ' . $articlePath); + $articlePageHtml = getSimpleHTMLDOMCached($articlePath, 3600); $item['uri'] = $articlePath; $item['title'] = $articlePageHtml->find('article-title', 0)->innertext; diff --git a/bridges/BundestagParteispendenBridge.php b/bridges/BundestagParteispendenBridge.php index cdf398e8..30817d96 100644 --- a/bridges/BundestagParteispendenBridge.php +++ b/bridges/BundestagParteispendenBridge.php @@ -26,8 +26,7 @@ TMPL; https://www.bundestag.de/ajax/filterlist/de/parlament/praesidium/parteienfinanzierung/fundstellen50000/462002-462002 URI; // Get the main page - $html = getSimpleHTMLDOMCached($ajaxUri, self::CACHE_TIMEOUT) - or returnServerError('Could not request AJAX list.'); + $html = getSimpleHTMLDOMCached($ajaxUri, self::CACHE_TIMEOUT); // Build the URL from the first anchor element. The list is sorted by year, descending, so the first element is the current year. $firstAnchor = $html->find('a', 0) @@ -36,8 +35,7 @@ URI; $url = 'https://www.bundestag.de' . $firstAnchor->href; // Get the actual page with the soft money donations - $html = getSimpleHTMLDOMCached($url, self::CACHE_TIMEOUT) - or returnServerError('Could not request ' . $url); + $html = getSimpleHTMLDOMCached($url, self::CACHE_TIMEOUT); $rows = $html->find('table.table > tbody > tr') or returnServerError('Could not find the proper HTML elements.'); diff --git a/bridges/CrewbayBridge.php b/bridges/CrewbayBridge.php index 0ca017c2..0fb9def6 100644 --- a/bridges/CrewbayBridge.php +++ b/bridges/CrewbayBridge.php @@ -109,7 +109,7 @@ class CrewbayBridge extends BridgeAbstract public function collectData() { $url = $this->getURI(); - $html = getSimpleHTMLDOM($url) or returnClientError('No results for this query.'); + $html = getSimpleHTMLDOM($url); $annonces = $html->find('#SearchResults div.result'); $limit = 0; diff --git a/bridges/DacksnackBridge.php b/bridges/DacksnackBridge.php index 7aab48d1..a031706e 100644 --- a/bridges/DacksnackBridge.php +++ b/bridges/DacksnackBridge.php @@ -53,8 +53,7 @@ class DacksnackBridge extends BridgeAbstract public function collectData() { $NEWSURL = self::URI; - $html = getSimpleHTMLDOMCached($NEWSURL, 18000) or - returnServerError('Could not request: ' . $NEWSURL); + $html = getSimpleHTMLDOMCached($NEWSURL, 18000); foreach ($html->find('a.main-news-item') as $element) { // Debug::log($element); @@ -64,8 +63,7 @@ class DacksnackBridge extends BridgeAbstract $url = self::URI . $element->getAttribute('href'); $published = $this->parseSwedishDates(trim($element->find('.published', 0)->plaintext)); - $article_html = getSimpleHTMLDOMCached($url, 18000) or - returnServerError('Could not request: ' . $url); + $article_html = getSimpleHTMLDOMCached($url, 18000); $article_content = $article_html->find('#ctl00_ContentPlaceHolder1_NewsArticleVeiw_pnlArticle', 0); $figure = self::URI . $article_content->find('img.news-image', 0)->getAttribute('src'); diff --git a/bridges/DagensNyheterDirektBridge.php b/bridges/DagensNyheterDirektBridge.php index f0748b76..fa219a09 100644 --- a/bridges/DagensNyheterDirektBridge.php +++ b/bridges/DagensNyheterDirektBridge.php @@ -18,8 +18,7 @@ class DagensNyheterDirektBridge extends BridgeAbstract { $NEWSURL = self::BASEURL . '/ajax/direkt/'; - $html = getSimpleHTMLDOM($NEWSURL) or - returnServerError('Could not request: ' . $NEWSURL); + $html = getSimpleHTMLDOM($NEWSURL); foreach ($html->find('article') as $element) { $link = $element->find('button', 0)->getAttribute('data-link'); diff --git a/bridges/FindACrewBridge.php b/bridges/FindACrewBridge.php index 9119535b..0bc181f3 100644 --- a/bridges/FindACrewBridge.php +++ b/bridges/FindACrewBridge.php @@ -60,7 +60,7 @@ class FindACrewBridge extends BridgeAbstract CURLOPT_POSTFIELDS => http_build_query($data) . "\n" ]; - $html = getSimpleHTMLDOM($url, $header, $opts) or returnClientError('No results for this query.'); + $html = getSimpleHTMLDOM($url, $header, $opts); $annonces = $html->find('.css_SrhRst'); $limit = $this->getInput('limit') ?? 10; diff --git a/bridges/FurAffinityUserBridge.php b/bridges/FurAffinityUserBridge.php index fa10d7ae..1866308d 100644 --- a/bridges/FurAffinityUserBridge.php +++ b/bridges/FurAffinityUserBridge.php @@ -34,8 +34,7 @@ class FurAffinityUserBridge extends BridgeAbstract $url = self::URI . '/gallery/' . $this->getInput('searchUsername'); - $html = getSimpleHTMLDOM($url, [], $opt) - or returnServerError('Could not load the user\'s gallery page.'); + $html = getSimpleHTMLDOM($url, [], $opt); $submissions = $html->find('section[id=gallery-gallery]', 0)->find('figure'); foreach ($submissions as $submission) { diff --git a/bridges/GiteaBridge.php b/bridges/GiteaBridge.php index f7f426e9..8433b6dd 100644 --- a/bridges/GiteaBridge.php +++ b/bridges/GiteaBridge.php @@ -155,8 +155,7 @@ class GiteaBridge extends BridgeAbstract public function collectData() { - $html = getSimpleHTMLDOM($this->getURI()) - or returnServerError('Could not request ' . $this->getURI()); + $html = getSimpleHTMLDOM($this->getURI()); $html = defaultLinkTo($html, $this->getURI()); $this->title = $html->find('[property="og:title"]', 0)->content; @@ -246,8 +245,7 @@ class GiteaBridge extends BridgeAbstract ]; if ($this->getInput('include_description')) { - $issue_html = getSimpleHTMLDOMCached($uri, 3600) - or returnServerError('Unable to load issue description'); + $issue_html = getSimpleHTMLDOMCached($uri, 3600); $issue_html = defaultLinkTo($issue_html, $uri); @@ -308,8 +306,7 @@ class GiteaBridge extends BridgeAbstract ]; if ($this->getInput('include_description')) { - $issue_html = getSimpleHTMLDOMCached($uri, 3600) - or returnServerError('Unable to load issue description'); + $issue_html = getSimpleHTMLDOMCached($uri, 3600); $issue_html = defaultLinkTo($issue_html, $uri); diff --git a/bridges/GlowficBridge.php b/bridges/GlowficBridge.php index 0e4b8d93..7a58a08f 100644 --- a/bridges/GlowficBridge.php +++ b/bridges/GlowficBridge.php @@ -28,7 +28,7 @@ class GlowficBridge extends BridgeAbstract public function collectData() { $url = $this->getAPIURI(); - $metadata = get_headers($url . '/replies', true) or returnClientError('Post did not return reply headers.'); + $metadata = get_headers($url . '/replies', true); $metadata['Last-Page'] = ceil($metadata['Total'] / $metadata['Per-Page']); if ( !is_null($this->getInput('start_page')) && diff --git a/bridges/GogsBridge.php b/bridges/GogsBridge.php index 685e5ba2..d838674f 100644 --- a/bridges/GogsBridge.php +++ b/bridges/GogsBridge.php @@ -171,8 +171,7 @@ class GogsBridge extends BridgeAbstract ]; if ($this->getInput('include_description')) { - $issue_html = getSimpleHTMLDOMCached($uri, 3600) - or returnServerError('Unable to load issue description'); + $issue_html = getSimpleHTMLDOMCached($uri, 3600); $issue_html = defaultLinkTo($issue_html, $uri); diff --git a/bridges/GoogleScholarBridge.php b/bridges/GoogleScholarBridge.php index 11dc123b..3004180f 100644 --- a/bridges/GoogleScholarBridge.php +++ b/bridges/GoogleScholarBridge.php @@ -109,7 +109,7 @@ class GoogleScholarBridge extends BridgeAbstract case 'user': $userId = $this->getInput('userId'); $uri = self::URI . '/citations?hl=en&view_op=list_works&sortby=pubdate&user=' . $userId; - $html = getSimpleHTMLDOM($uri) or returnServerError('Could not fetch Google Scholar data.'); + $html = getSimpleHTMLDOM($uri); $publications = $html->find('tr[class="gsc_a_tr"]'); @@ -184,7 +184,7 @@ class GoogleScholarBridge extends BridgeAbstract $uri .= $sortBy ? '&scisbd=1' : ''; $uri .= $numResults ? '&num=' . $numResults : ''; - $html = getSimpleHTMLDOM($uri) or returnServerError('Could not fetch Google Scholar data.'); + $html = getSimpleHTMLDOM($uri); $publications = $html->find('div[class="gs_r gs_or gs_scl"]'); diff --git a/bridges/ItakuBridge.php b/bridges/ItakuBridge.php index b231b143..22d7529f 100644 --- a/bridges/ItakuBridge.php +++ b/bridges/ItakuBridge.php @@ -438,8 +438,7 @@ class ItakuBridge extends BridgeAbstract private function getOwnerID($username) { $url = self::URI . "/api/user_profiles/{$username}/?format=json"; - $data = $this->getData($url, true, true) - or returnServerError("Could not load $url"); + $data = $this->getData($url, true, true); return $data['owner']; } @@ -451,8 +450,7 @@ class ItakuBridge extends BridgeAbstract } $uri = self::URI . '/posts/' . $id; $url = self::URI . '/api/posts/' . $id . '/?format=json'; - $data = $metadata ?? $this->getData($url, true, true) - or returnServerError("Could not load $url"); + $data = $metadata ?? $this->getData($url, true, true); $content_str = nl2br($data['content']); $content = "

{$content_str}


"; //TODO: Add link and itaku user mention detection and convert into links. @@ -497,8 +495,7 @@ class ItakuBridge extends BridgeAbstract $content .= "{$title}
"; if ($media['is_thumbnail_for_video']) { $url = self::URI . '/api/galleries/images/' . $media['id'] . '/?format=json'; - $media_data = $this->getData($url, true, true) - or returnServerError("Could not load $url"); + $media_data = $this->getData($url, true, true); $content .= "