Skip to content

jQuery RSS/ATOM feed parser plugin in CoffeeScript, with support for non-standard item tags

License

Notifications You must be signed in to change notification settings

invernizzie/coffeed

 
 

Repository files navigation

coffeed : jQuery feed parser plugin in CoffeeScript, with support for non-standard item tags
Copyright (C) 2011 Esteban Ignacio Invernizzi - [email protected]
Licensed under the MIT (MIT-license.txt) license.

based on...

+----------------------------------------------------------------------+
| jFeed : jQuery feed parser plugin                                    |
| Copyright (C) 2007 Jean-François Hovinne - http://www.hovinne.com/   |
| Dual licensed under the MIT (MIT-license.txt)                        |
| and GPL (GPL-license.txt) licenses.                                  |
|                                                                      |
| http://hovinne.com/articles/jfeed-jquery-rss-atom-feed-parser-plugin |
+----------------------------------------------------------------------+

Usage
=====

    jQuery.getFeed(options)
    
    options:
    
    * url: the feed URL (required).
    * data: data to be sent to the server. See jQuery.ajax data property.
    * success: a function to be called if the request succeeds.
      The function gets passed one argument: the Coffeed object.
    
    Example:
    
    jQuery.getFeed
        url: 'rss.xml'
        success: (feed) ->
            alert feed.title
    
Coffeed properties
================

    * feed.type
    * feed.version
    * feed.title
    * feed.link
    * feed.description
    * feed.language
    * feed.updated
    * feed.items: an array of CoffeedItem
    
CoffeedItem properties
====================

    * item.title
    * item.link
    * item.description
    * item.pubDate
    * item.guid
    * a property for every other tag name found inside each <item></item> block

    Every property is an object with the structure:

    property
    |
    +- text
    +- attrs

    where text is the text content of the tag, and attrs has a property for each
    tag attribute of the same name.

    For example, an item with the structure:

    <item>
        <title id="feed-1">Feed title</title>
    </item>

    will result in a CoffeedItem like:

    {
        title: {
            text: "Feed title",
            attrs: {
                id: "feed-1"
            }
        }
    }

    Any property whose tagname is repeated inside an item block will be an 
    array containing an element for each one, in order of appearance. For example
    for the item:

    <item>
        <link src="http://www.myfeed.com">My feed</link>
        <link src="http://www.myotherfeed.com">My other feed</link>
    </item>

    the following CoffeedItem will be built:

    {
        link: [
            {
                text: "My feed",
                attrs: {
                    src: "http://www.myfeed.com"
                }
            }, {
                text: "My other feed",
                attrs: {
                    src: "http://www.myotherfeed.com"
                }
            }
        ]
    }

Please see the provided examples for more information.

A basic PHP proxy is also available (proxy.php), if you need to load external
feeds (for testing purposes only, do not use it on public websites).

About

jQuery RSS/ATOM feed parser plugin in CoffeeScript, with support for non-standard item tags

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Perl 86.5%
  • CoffeeScript 12.9%
  • PHP 0.6%