From a54eb88ee1fe164a5ab19dae52cad20e1aa2d2db Mon Sep 17 00:00:00 2001 From: Joseph Date: Wed, 26 Feb 2020 20:56:03 +0000 Subject: [PATCH] [DevToBridge] Fix bridge & add getName() (#1470) --- bridges/DevToBridge.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bridges/DevToBridge.php b/bridges/DevToBridge.php index 868ac976..c298d462 100644 --- a/bridges/DevToBridge.php +++ b/bridges/DevToBridge.php @@ -51,15 +51,10 @@ apple-icon-5c6fa9f2bce280428589c6195b7f1924206a53b782b371cfe2d02da932c8c173.png' $html = defaultLinkTo($html, static::URI); - $articles = $html->find('div[class="single-article"]') + $articles = $html->find('div.single-article') or returnServerError('Could not find articles!'); foreach($articles as $article) { - - if($article->find('[class*="cta"]', 0)) { // Skip ads - continue; - } - $item = array(); $item['uri'] = $article->find('a[id*=article-link]', 0)->href; @@ -92,6 +87,14 @@ EOD; } + public function getName() { + if (!is_null($this->getInput('tag'))) { + return ucfirst($this->getInput('tag')) . ' - dev.to'; + } + + return parent::getName(); + } + private function getFullArticle($url) { $html = getSimpleHTMLDOMCached($url) or returnServerError('Unable to load article from "' . $url . '"!');