All Projects → fent → Feedme.js

fent / Feedme.js

Licence: mit
RSS/Atom/JSON feed parser

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Feedme.js

Feedreader
C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.
Stars: ✭ 180 (+36.36%)
Mutual labels:  feed-reader, rss, atom
Node Feedsub
Subscribes to RSS/Atom/JSON feeds and notifies on new items.
Stars: ✭ 170 (+28.79%)
Mutual labels:  feed-reader, rss, atom
Pluto
pluto gems - planet feed reader and (static) website generator - auto-build web pages from published web feeds
Stars: ✭ 174 (+31.82%)
Mutual labels:  feed-reader, rss, atom
Brief
RSS reader extension for Firefox
Stars: ✭ 184 (+39.39%)
Mutual labels:  feed-reader, rss, atom
JARR
JARR is a web news aggregator.
Stars: ✭ 99 (-25%)
Mutual labels:  atom, rss, feed-reader
webfeed
A dart package for parsing RSS & Atom feed
Stars: ✭ 92 (-30.3%)
Mutual labels:  atom, rss, feed-reader
FeedReader
C# RSS and ATOM Feed reader library. Supports RSS 0.91, 0.92, 1.0, 2.0 and ATOM. Tested with multiple languages and feeds.
Stars: ✭ 221 (+67.42%)
Mutual labels:  atom, rss, feed-reader
buran
Bidirectional, data-driven RSS/Atom feed consumer, producer and feeds aggregator
Stars: ✭ 27 (-79.55%)
Mutual labels:  atom, rss, feed-reader
Neix
neix - a RSS/Atom feed reader for your terminal.
Stars: ✭ 128 (-3.03%)
Mutual labels:  feed-reader, rss
Newsblur
NewsBlur is a personal news reader that brings people together to talk about the world. A new sound of an old instrument.
Stars: ✭ 5,862 (+4340.91%)
Mutual labels:  feed-reader, rss
Newsbeuter
Newsbeuter is an open-source RSS/Atom feed reader for text terminals.
Stars: ✭ 783 (+493.18%)
Mutual labels:  feed-reader, rss
Jekyll Feed
📝 A Jekyll plugin to generate an Atom (RSS-like) feed of your Jekyll posts
Stars: ✭ 630 (+377.27%)
Mutual labels:  rss, atom
Cypht
Cypht: Lightweight Open Source webmail written in PHP and JavaScript
Stars: ✭ 628 (+375.76%)
Mutual labels:  rss, atom
Feedreader
Modern desktop application designed to complement existing web-based RSS accounts.
Stars: ✭ 765 (+479.55%)
Mutual labels:  feed-reader, rss
Liferea
Liferea (Linux Feed Reader), a news reader for GTK/GNOME
Stars: ✭ 612 (+363.64%)
Mutual labels:  rss, atom
Miniflux Legacy
Minimalist RSS reader (version 1.x)
Stars: ✭ 897 (+579.55%)
Mutual labels:  rss, atom
Feeds2imap.clj
Pull RSS/Atom feeds to your IMAP folders with Clojure on JVM.
Stars: ✭ 31 (-76.52%)
Mutual labels:  rss, atom
Feeds
golang rss/atom generator library
Stars: ✭ 542 (+310.61%)
Mutual labels:  rss, atom
Feedkit
An RSS, Atom and JSON Feed parser written in Swift
Stars: ✭ 895 (+578.03%)
Mutual labels:  rss, atom
Gofeed
Parse RSS, Atom and JSON feeds in Go
Stars: ✭ 1,762 (+1234.85%)
Mutual labels:  rss, atom

FeedMe.js

feedme.js is an RSS/Atom/JSON feed parser. How is this different from the other few feed parsers? It uses sax-js for xml parsing and clarinet for json parsing. That means it is coded in pure Javascript and thus more deployable. I needed a parser that wouldn't require me to install external dependencies or to compile anything.

Depfu codecov

Usage

const FeedMe = require('feedme');
const http = require('http');

http.get('http://www.npr.org/rss/rss.php?id=1001', (res) => {
  if (res.statusCode != 200) {
    console.error(new Error(`status code ${res.statusCode}`));
    return;
  }
  let parser = new FeedMe();
  parser.on('title', (title) => {
    console.log('title of feed is', title);
  });
  parser.on('item', (item) => {
    console.log();
    console.log('news:', item.title);
    console.log(item.description);
  });
  res.pipe(parser);
});

API

new FeedMe([buffer])

Creates a new instance of the FeedMe parser. buffer can be true if you want the parser to buffer the entire feed document as a JSON object, letting you use the FeedMe#done() method.

parser.write(xml)

Write to the parser.

parser.done()

Can only be used if buffer is true. It returns the feed as a Javascript object, should be called after end is emitted from the parser. Subelements are put as children objects with their names as keys. When one object has more than one child of the same name, they are put into an array. Items are always put into an array.

const FeedMe = require('feedme');
const http = require('http');

http.get('https://nodejs.org/en/feed/blog.xml', (res) => {
  let parser = new FeedMe(true);
  res.pipe(parser);
  parser.on('finish', () => {
    console.log(parser.done());
  });
});

An example of what parser.done() could return.

{
  type: 'rss 2.0',
  title: 'Liftoff News',
  link: 'http://liftoff.msfc.nasa.gov/',
  description: 'Liftoff to Space Exploration.',
  language: 'en-us',
  pubdate: 'Tue, 10 Jun 2003 04:00:00 GMT',
  lastbuilddate: 'Tue, 10 Jun 2003 09:41:01 GMT',
  docs: 'http://blogs.law.harvard.edu/tech/rss',
  generator: 'Weblog Editor 2.0',
  managingeditor: '[email protected]',
  webmaster: '[email protected]',
  items:  [
    {
      title: 'Star City',
      link: 'http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp',
      description: 'How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia\'s <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>.',
      pubdate: 'Tue, 03 Jun 2003 09:39:21 GMT',
      guid: 'http://liftoff.msfc.nasa.gov/2003/06/03.html#item573'
    },
    {
      description: 'Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm">partial eclipse of the Sun</a> on Saturday, May 31st.',
      pubdate: 'Fri, 30 May 2003 11:06:42 GMT',
      guid: 'http://liftoff.msfc.nasa.gov/2003/05/30.html#item572'    },
    {
      title: 'The Engine That Does More',
      link: 'http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp',
      description: 'Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly.  The proposed VASIMR engine would do that.',
      pubdate: 'Tue, 27 May 2003 08:37:32 GMT',
      guid: 'http://liftoff.msfc.nasa.gov/2003/05/27.html#item571'    },
    {
      title: 'Astronauts\' Dirty Laundry',
      link: 'http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp',
      description: 'Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them.  Instead, astronauts have other options.',
      pubdate: 'Tue, 20 May 2003 08:56:02 GMT',
      guid: 'http://liftoff.msfc.nasa.gov/2003/05/20.html#item570'    }
  ]
}

Event: 'item'

  • Object - Item from the feed.

Emitted whenever the parser finds a new feed item. An item can be inside an <item> or ` tag.

Event: tagname

  • Object - The object containing the value of the tag found.

Emitted whenever a tag on the root of the document is finished parsing. The root being the <channel> or <feed> tag. Example:

parser.on('description', (d) => {
  // do something
});

Event: 'type'

  • string - Type of feed. Example: atom, rss 2.0, json.

Event: 'error'

  • Error

Emitted when there is an error parsing the document.

Install

npm install feedme

Tests

Tests are written with mocha

npm test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].