coffeenode-rss

0.0.8 • Public • Published

coffeenode-rss

RSS XML-blahfoo to liteweight JSON / HTML converter middleware

This software is probably not ready for general consumption, as it was built for a very specific purpose.

In your Express server's app.coffee, add a request handler like this:

app.get '/vouchers/:tags?'( request, response ) ->
  request_tags  = RSS.normalize_tags ( request.params[ 'tags' ? '' ).split ','
  url           = "https://gueltiger-gutschein.de/tag/#{request_tags.join ','}/feed"
  RSS.read url( error, rss ) =>
   ### `rss` now contains all entries with *any* of the tags; next we filter out all entries that are not
   *not* marked with *all* of the tags specified in the request: ###
    rss = RSS.filter_for_tags rssrequest_tags
    response.json rss

Here is what you could do on an HTML page to fetch the RSS and display its entries:

$( document ).ready ->
    tags = 'berlin,vodafone'
    $.get "/vouchers/#{tags}"( rss, status, jqXHR ) ->
        # if status isnt 'success' 
        vouchers = []
        for entry in rss
            vouchers.push "<div class='entry'>#{entry[ 'content' ]}</div>"
        ( $ '#vouchers' ).html vouchers.join '\n'

Readme

Keywords

none

Package Sidebar

Install

npm i coffeenode-rss

Weekly Downloads

10

Version

0.0.8

License

ISC

Last publish

Collaborators

  • loveencounterflow