Skip to content

Instantly share code, notes, and snippets.

@arky
Created September 22, 2013 12:56
Show Gist options
  • Save arky/6659651 to your computer and use it in GitHub Desktop.
Save arky/6659651 to your computer and use it in GitHub Desktop.
Daily Words Google Apps Script Google Apps Script to parse and display wordsmith.org A Word A Day RSS Feed http://playingwithsid.blogspot.com/2013/09/google-apps-script-for-google-sites.html
//Parses Wordsmith XML Feed
function doGet(){
// Fetch XML
var response = UrlFetchApp.fetch("http://wordsmith.org/awad/rss1.xml").getContentText();
// Parse XML
var parsedResponse = Xml.parse(response, false);
var word = parsedResponse.getElement().getElement('channel').getElement('item').getElement('title').getText();
var desc = parsedResponse.getElement().getElement('channel').getElement('item').getElement('description').getText();
// Create UI
var app = UiApp.createApplication();
// Create labels
var wordLabel= app.createLabel(word).setStyleAttribute("fontSize","16px");
var descLabel= app.createLabel(desc).setStyleAttribute("fontSize","12px");
// add the label to the app container
app.add(wordLabel);
app.add(descLabel);
// Return App
return app;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment