1.1.5 • Published 8 years ago

feeder-parser v1.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

feeder-parser

An extremely pragmatic approach to parsing RSS and Atom feeds. Used to run feeder.co extension and pro service.

Tests need to be ported to this repo...

var http = require("http");

var RSSParser = require("feeder-parser").RSSParser;

// The first parameter to the RSSParser constructor should be an object with a `path` attribute
var feed = {
	path: "http://www.reddit.com/r/all.rss"
}

function parse(body) {
	var parser = new RSSParser(feed);
	parser.setResult(body);
	parser.parse(function(parser) {
		parser.posts.forEach(function(post) {
			console.log(post.title);
		});
	});
}

function fetch(url, callback) {
	http.get(url, function(res) {
		var data = [];

		res.setEncoding("utf8");
		res.on("data", function(chunk) {
			data.push(chunk);
		});

		res.on("end", function() {
			callback(data.join(""));
		});
	});
}

fetch(feed.path, parse);
1.1.5

8 years ago

1.1.4

9 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago