From 54e2cd52310a8e5165fbe2e8483b07a1f5d63628 Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Fri, 31 Jul 2015 10:54:33 +0100 Subject: [PATCH] debugging braider --- .idea/sonarIssues.xml | 5 - .idea/vcs.xml | 2 +- .idea/workspace.xml | 176 +++++++++++++++++---- lifestyle.js | 10 +- node_modules/rss-braider/lib/RssBraider.js | 5 +- 5 files changed, 162 insertions(+), 36 deletions(-) diff --git a/.idea/sonarIssues.xml b/.idea/sonarIssues.xml index be2cbc3..8237989 100644 --- a/.idea/sonarIssues.xml +++ b/.idea/sonarIssues.xml @@ -3,11 +3,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -378,6 +484,13 @@ @@ -386,9 +499,10 @@ + - + @@ -727,18 +841,26 @@ - + - - + + - - + + + + + + + + + + diff --git a/lifestyle.js b/lifestyle.js index bf231c5..fa781a5 100644 --- a/lifestyle.js +++ b/lifestyle.js @@ -209,7 +209,15 @@ rss_braider.processFeed('simple_test_feed', 'json', function (err, data) { return console.log(err); } - var j = JSON.parse(data); + var j; + try{ + j = JSON.parse(data); + }catch(e){ + console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); + console.log(e); + console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); + } + var ejsOutput = ejs.compile(str)(j); fs.writeFile(__dirname + "/html/" + outputFile + ".json", data, function (err) { diff --git a/node_modules/rss-braider/lib/RssBraider.js b/node_modules/rss-braider/lib/RssBraider.js index 990aefa..a165355 100644 --- a/node_modules/rss-braider/lib/RssBraider.js +++ b/node_modules/rss-braider/lib/RssBraider.js @@ -132,7 +132,7 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback) feedparser.on("end", function(){ // de-dupe , date sort, and trim this feed's articles and push them into array console.log('** Go for dedupe'); - console.log(feed.meta.site_url); + console.log(source.feed_url); source_articles = self.dedupe(source_articles, self.dedupe_fields); console.log('** Go for dateSort'); source_articles = self.date_sort(source_articles); @@ -150,7 +150,7 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback) } else { // Final Dedupe step and resort console.log('** ERR Go for dedupe'); - console.log(feed.meta.site_url); + feed_articles = self.dedupe(feed_articles, self.dedupe_fields); feed_articles = self.date_sort(feed_articles); @@ -269,6 +269,7 @@ RssBraider.prototype.dedupe = function(articles_arr, fields){ articles_arr.forEach(function(article){ var count = 0; fields.forEach(function(field){ + console.log('---'); console.log(field); console.log(uniques[field]); if (!uniques[field]) {