How to parse the title of each item of a feed in Google Apps Scripts

I try to simply parse a RSS feed, but i get an error. How can i get the "Title" of each item?
It says "Cannot read property ‘getText’ of null"

I have no clue how i can debug this.

function parseFeed() {
  var feed = UrlFetchApp.fetch("").getContentText();
  feed = XmlService.parse(feed);

  var namespace = XmlService.getNamespace("");
  var items = feed.getRootElement().getChildren("entry", namespace);  

items.forEach(item => {
    var title = item.getChild('title').getText();


>Solution :

When your showing script is modified, how about the following modification?


var title = item.getChild('title').getText();


var title = item.getChild('title', namespace).getText();

Leave a Reply