Skip to content

Commit

Permalink
[DevToBridge] Fix bridge & add getName() (RSS-Bridge#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
VerifiedJoseph authored Feb 26, 2020
1 parent 1d75a73 commit 3cb7f12
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bridges/DevToBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,10 @@ public function collectData() {

$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;
Expand Down Expand Up @@ -92,6 +87,14 @@ public function collectData() {

}

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 . '"!');
Expand Down

0 comments on commit 3cb7f12

Please sign in to comment.