Created
September 22, 2013 12:56
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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