Skip to content

Commit

Permalink
unused TryCatch removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
maitegm authored and Alp Toker committed Jul 15, 2017
1 parent affa25f commit c73fc63
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions crawler.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,14 @@ class BlockCrawler extends EventEmitter {
//console.log($("title").text());
$('a').each((index, node) => {
var $node = $(node);

try {
var rel = $node.attr('rel') || '';
rel = rel.split(/ +/);
if (rel.indexOf('nofollow') !== -1)
return;
var href = $node.attr('href');
if(!href)
return;
var href = href.split('#')[0];
} catch (err) {
// TODO: Handle malformed URLs instead of this catch-all
var rel = $node.attr('rel') || '';
rel = rel.split(/ +/);
if (rel.indexOf('nofollow') !== -1)
return;
}

var href = $node.attr('href');
if(!href)
return;
var href = href.split('#')[0];
this.enqueue(href, res);
});
}
Expand Down

0 comments on commit c73fc63

Please sign in to comment.