Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheuschimelli/c2dacbde36df0c2c0f136a05473a88db to your computer and use it in GitHub Desktop.
Save matheuschimelli/c2dacbde36df0c2c0f136a05473a88db to your computer and use it in GitHub Desktop.
google app script
function traduz(title, fromLang, toLang){
LanguageApp.translate(title, fromLang, toLang);
}
function g1() {
var array = [];
var url = 'https://g1.globo.com/rss/g1';
var feed = UrlFetchApp.fetch(url).getContentText();
feed = XmlService.parse(feed);
var items = feed.getRootElement().getChild("channel").getChildren("item");
for (var i in items) {
var link = items[i].getChild("link").getValue();
// avoid adding duplicates
var title = items[i].getChild("title").getValue();
array.push([link, title]);
}
return array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment