Texan78 Posted May 15, 2015 Share Posted May 15, 2015 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 https://forums.phpfreaks.com/topic/296336-add-rss-entry-via-javascript/ Share on other sites More sharing options...
Texan78 Posted May 15, 2015 Author Share Posted May 15, 2015 Disregard this post. I found an alternative method. Created a php script on my server that parses the XML file then call it internally from the program using the remote file option and it works great. Link to comment https://forums.phpfreaks.com/topic/296336-add-rss-entry-via-javascript/#findComment-1511972 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.