Last active
December 23, 2015 15:59
-
-
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
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
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