Jump to content

Add RSS entry via Javascript


Texan78
Go to solution Solved by Texan78,

Recommended Posts

Hello, first let me say I am HORRIBLE with Javascript. I am using this program called Xsplit for live streaming. It has the ability to add the title from an RSS feed. That is great but, I would also like to add another node called "summary" and I will be honest, I have no clue after trying several things and searching the net. 

 

Here is the script it uses. 

/*
    This shows title of RSS feed entries from [RSS_FEED_URL]
    each item sepated by "||", number of entries shown can be specified using the [NUMBER_OF_ENTRIES] variable.
    This only checks for feed once (on scene load)
*/

/**
 * @name RSS_FEED_URL
 * @label RSS Feed Url
 * @type text
 */
var RSS_FEED_URL = "http://alerts.weather.gov/cap/wwaatmget.php?x=TXZ119&y=1";

/**
 * @name NUMBER_OF_ENTRIES
 * @label Number of Entries
 * @type spinner
 * @min 1
 * @max 20
 * @step 1
 * @description Values, 1-20
 */
var NUMBER_OF_ENTRIES = 8;

/*Do not modify anything below*/

scriptLoading();

function scriptLoading(){

var headID = document.getElementsByTagName("head")[0];         
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = "http://www.google.com/jsapi";
newScript.onload = initial;

headID.appendChild(newScript);
}


function initial(){

google.load("feeds", "1", {"callback" : initialize});

}
var CombinedEntries="";
var initialize = function() {
    
    var feed = new google.feeds.Feed(RSS_FEED_URL);
    
    feed.setNumEntries(NUMBER_OF_ENTRIES);
    feed.load(function (result) {
        if (!result.error) {
            
            var container = document.getElementById("feed");
            var entries = new Array();
            
            var i=0;
            for (; i < result.feed.entries.length; i++) {
                
                var entry = result.feed.entries[i];
                
                entries[i] = entry;
                
                CombinedEntries=CombinedEntries+" || "+entry.title";
                
            }
          SetText(CombinedEntries, "RSS Feed Reader: " + RSS_FEED_URL);
        }
    });
};

if (smlTitleTimeouts && smlTitleTimeouts != null)
    clearTimeout(smlTitleTimeouts);

This line adds the title, that much I can tell. 

CombinedEntries=CombinedEntries+" || "+entry.title";

If I try to add another line but change title to summary it comes back undefined. 

 

So how could I add another another node. Both title and summary are both under the same parent node which is "entry". I would just like to add "summary" to this as well but not sure how. Can anyone help me out?

 

-Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.