Skip to content

Instantly share code, notes, and snippets.

@arky
Last active December 23, 2015 15:59
Show Gist options
  • Save arky/6659489 to your computer and use it in GitHub Desktop.
Save arky/6659489 to your computer and use it in GitHub Desktop.
Google Apps Script to parse and display wordcentral.com's Daily Buzzword RSS feed. http://playingwithsid.blogspot.com/2013/09/google-apps-script-for-google-sites.html
function doGet() {
// Fetch XML
var response = UrlFetchApp.fetch("http://wordcentral.com/buzzword/rss.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();
var re = new RegExp('<div class="defset".*</div></div>', "g");
var myArray = desc.match(re);
var def = myArray[0];
return HtmlService.createHtmlOutput( '<div style="background-color:#e9eccf"><h2>' + word + "</h2>" + def + "</div>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment