debugging braider
This commit is contained in:
parent
0c720448ab
commit
a164da9f25
9
node_modules/rss-braider/lib/RssBraider.js
generated
vendored
9
node_modules/rss-braider/lib/RssBraider.js
generated
vendored
@ -79,11 +79,13 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
|
|||||||
// Process each feed source through Feedparser to get articles.
|
// Process each feed source through Feedparser to get articles.
|
||||||
// Then process each item/article through rss-braider and any plugins
|
// Then process each item/article through rss-braider and any plugins
|
||||||
async.each(feed.sources, function(source, callback) {
|
async.each(feed.sources, function(source, callback) {
|
||||||
|
console.log('+ async.each');
|
||||||
var count = source.count || feed.default_count || 10, // Number of articles per source
|
var count = source.count || feed.default_count || 10, // Number of articles per source
|
||||||
url = source.feed_url || null,
|
url = source.feed_url || null,
|
||||||
file_path = source.file_path || null,
|
file_path = source.file_path || null,
|
||||||
source_articles = [];
|
source_articles = [];
|
||||||
|
|
||||||
|
console.log('Pre FeedParser');
|
||||||
var feedparser = new FeedParser();
|
var feedparser = new FeedParser();
|
||||||
if (url) {
|
if (url) {
|
||||||
var req = request(url);
|
var req = request(url);
|
||||||
@ -97,10 +99,12 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
|
|||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
return this.emit('error', 'Bad status code: ' + res.statusCode);
|
return this.emit('error', 'Bad status code: ' + res.statusCode);
|
||||||
}
|
}
|
||||||
|
console.log('** DO FEED Parser A');
|
||||||
stream.pipe(feedparser);
|
stream.pipe(feedparser);
|
||||||
});
|
});
|
||||||
} else if (file_path) {
|
} else if (file_path) {
|
||||||
// open file
|
// open file
|
||||||
|
console.log('** DO FEED Parser B');
|
||||||
var filestream = fs.createReadStream(file_path);
|
var filestream = fs.createReadStream(file_path);
|
||||||
filestream.pipe(feedparser);
|
filestream.pipe(feedparser);
|
||||||
} else {
|
} else {
|
||||||
@ -114,6 +118,7 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
|
|||||||
|
|
||||||
// Collect the articles from this source
|
// Collect the articles from this source
|
||||||
feedparser.on('readable', function() {
|
feedparser.on('readable', function() {
|
||||||
|
console.log('+ readable: ' + source.feed_url);
|
||||||
var stream = this,
|
var stream = this,
|
||||||
item;
|
item;
|
||||||
|
|
||||||
@ -129,9 +134,11 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
|
|||||||
source_articles.push(article);
|
source_articles.push(article);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('- readable');
|
||||||
});
|
});
|
||||||
|
|
||||||
feedparser.on("end", function(){
|
feedparser.on("end", function(){
|
||||||
|
console.log('+ end');
|
||||||
// de-dupe , date sort, and trim this feed's articles and push them into array
|
// de-dupe , date sort, and trim this feed's articles and push them into array
|
||||||
|
|
||||||
// console.log('** Go for dedupe');
|
// console.log('** Go for dedupe');
|
||||||
@ -143,7 +150,9 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback)
|
|||||||
source_articles = source_articles.slice(0, count);
|
source_articles = source_articles.slice(0, count);
|
||||||
feed_articles = feed_articles.concat(source_articles);
|
feed_articles = feed_articles.concat(source_articles);
|
||||||
callback();
|
callback();
|
||||||
|
console.log('- end');
|
||||||
});
|
});
|
||||||
|
console.log('- async.each');
|
||||||
},
|
},
|
||||||
function(err){
|
function(err){
|
||||||
if (err) {
|
if (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user