Skip to content

A pragmatic RSS parser. Open source parser for feeder.co extension and pro service

Notifications You must be signed in to change notification settings

feederco/feeder-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

A pragmatic RSS parser. Open source parser for feeder.co extension and pro service

Resources

Stars

Watchers

Forks

Packages

No packages published