3 Replies Latest reply on Nov 4, 2012 7:35 AM by joel_pau

    How to fetch rss feed in Edge Animate?

    Girish@2adpro

      Hi All,

       

      I am very new to Edge Animate. I am trying whether we can fetch RSS feed in Edge animate like Twitter feed or not.  I don't have any idea how to do it? Can any one help me in this?

       

       

      Thanks

        • 1. Re: How to fetch rss feed in Edge Animate?
          joel_pau Level 5

          Hi,

           

          You have a tuto and sample files here (you have a jsonP example).

          RSS feed can be managed using jQuery (Ajax and json, jsonP).

          Here: you have a json example (Post #6).

          • 2. Re: How to fetch rss feed in Edge Animate?
            Girish@2adpro Level 1

            Hi Joel,

             

            I already gone through the tutorial, but still having problem in fetching the content. Below is my code which i am triggering on composition ready:

             

            try {

                var feedURL = 'http://www.facebook.com/feeds/page.php?id=163276271689&format=json';

             

                $.ajax({url: feedURL, dataType: 'jsonp'})

                    .success(function(data) {

                        $.each(data, function(index, entries){

                            alert("DONE");

                            var itemRenderer = sym.createChildSymbol("itemRenderer", "feedContainer");

                            itemRenderer.$('title').html( entries.title );

                            itemRenderer.$('desc').html( entries.content);

                        });

             

                    });

             

            }

            catch(error) {

                alert("Error: "+error.toString());

            }

             

            Pls let me know if i am doing any wrong...

             

            thanks

            • 3. Re: How to fetch rss feed in Edge Animate?
              joel_pau Level 5

              Well, i can not test your variable feedURL. Browser returns:

              facebook.jpg

              Note: you must be authorized.

               

              Then, you can try these test lines (compositionReady):

               

              $.ajax({

                              url: feedURL,

                              dataType: 'json',

                              success: function(data) {

                                   console.log(data.entries);//developer tools: console

                                   $.each(data.entries, function(index, item){

                                       var itemRenderer = sym.createChildSymbol("itemRenderer", "feedContainer");

                                       var title = item.title;

                                       if (title.length == 1) {title = "no title ==> only pics"};

                                       console.log(title.length+': '+title);//developer tools: console

                                       var content = item.content;

                                       console.log(content.length+': '+content);//developer tools: console

                                       itemRenderer.$('title').html(title);

                                       itemRenderer.$('desc').html(content);

                                   })

                              },

                              error: function(){

                                  var itemRenderer = sym.createChildSymbol("itemRenderer", "feedContainer");

                                  itemRenderer.$('title').html(':) Facebook is unavailable!');

                              }

              });

               

               

              Therefore, your code has 2 errors:

              • error #1: $.ajax({url: feedURL, dataType: 'jsonp'}) ==> $.ajax({url: feedURL, dataType: 'json'})
              • error #2: $.each(data, function(index, entries){ ==> $.each(data.entries, function(index, entries)

               

               

              Now, if you want to hide feeds without title:

              if (title.length == 1) {

              //title = "no title ==> only pics";

              itemRenderer.getSymbolElement().hide();

              };