FeedMagickInfotron

Sample Declaration

<div id="bulletlist"      
      script="http://localhost/BulletList.js">
</div>
## Dependencies + none ## Input Terminals + json_rss_in: (expected message type: a feedmagik json object) ## Output Terminals + textscrap_collection_out (An array of textscraps to be emedded in another viewing infotron somwhere) ## Properties + none ## Demos that use it + 43.html + evdb.html + rss\_feeds\_timeline.html ## How does it work? If you use another infotron (HttpProxy, for instance) to get the feed off feedmagik, you'll receive a json object as described below. This blueprint will convert the feed to a generic textscrap array which is used by several other blueprints.

/*
  FeedMagick JSON RSS format
  
  { feed_type: 'RSS',
    feed_version: '2.0',
    channel : 
    {
      title: 'Everyone\'s Photos',
      link: 'http://www.flickr.com/photos/',
      description: '',
      language:'en-US',
      category:'Events',
      generator:'RSS Generator',
      docs:'',
      ttl:60,
      opensearch:{},
      tagline:'',
      author: 'Penut768',
      modified: new Date('2006-05-12 02:46:59'),
      items: 
        [
          {
        title: 'P1010056',
        link: 'http://www.flickr.com/photos/12852817@N00/144865167/',
        content: '

Penut768 posted a photo:

P1010056

', author: 'Penut768', category: [], issued: new Date('2006-05-12 02:46:59'), modified: new Date('2006-05-12 02:46:59'), id: 'tag:flickr.com,2004:/photo/144865167' } ] } } */ BLUEPRINT( "~01067126C6D0CF47bdBB14409B900AE9BC", [ ["json_rss_in", "onJsonRss", 10] ], [ "textscrap_collection_out" ], function (Class) { Class.prototype.onJsonRss = function(msg) { var coll = []; var n, item, result, results, issued, modified; try { results = msg.items; n = results.length; } catch (ex) { this.error(ex, "malformed JSON RSS output"); return; /*****************************************************************/ } for (i = 0; i < n; i++) { result = results[i]; item = {name:result.title, text_content:result.content, uri:result.link, date:[]}; issued = result.pubdate || ((result.dc) ? result.dc.date : null); if (issued) { if (typeof(issued) == "object" && issued.constructor == Date) { } else { issued = new Date(issued); } item.date.push(issued); } coll.push(item) } this.postMessage("textscrap_collection_out", coll); }; }, "JSON RSS to Textscrap collection");