I have a script to save RSS data into a Spreadsheet, but it still has shortcomings and problems.
I have received data in the form of title, time, article link. https://i.sstatic.net/9YTAF.png
I want the script to be able to retrieve descriptions based on tags or HTML classes from each article link, so that the data I get is title, time, description, article link
For example, I want to retrieve the description of a div class called entry-content from the article link https://e-ficiencia.com/samsung-climate-solutions-acudira-cyr-2023/
My hope is that the data I get on the Spreadsheet will be like this
https://i.sstatic.net/kT00s.png https://docs.google.com/spreadsheets/d/1lPn7xHEEI1NknN8l9w6hu4SkQburm8s-NdAjPsPc-NM/edit#gid=0
Following my Google Apps Script
function myFunction() {
getURLData();
}
function getURLData() {
var currentData = [];
var urltoCheck = ["https://e-ficiencia.com/feed/", "https://www.climanoticias.com/feed/all","https://www.proinstalaciones.com/actualidad/noticias?format=feed"];
for (var i = 0; i < urltoCheck.length; i++){
var ficiencaData = UrlFetchApp.fetch(urltoCheck[i]);
var xml = ficiencaData.getContentText()
let response = XmlService.parse(xml);
var root = response.getRootElement();
let channel = root.getChild('channel');
let items = channel.getChildren('item');
items.forEach(item => {
let title = item.getChild('title').getText();
let pubDateb = item.getChild('pubDate').getText();
let link = item.getChild('link').getText();
currentData.push([title,pubDateb,link])
});
}
var ss = SpreadsheetApp.getActiveSpreadsheet()
var sheet = ss.getSheetByName("Sheet1");
var currentDataRange = sheet.getRange(sheet.getLastRow() + 1, 1, currentData.length, currentData[0].length);
currentDataRange.setValues(currentData);
}
My hope is that the data I get on the Spreadsheet will be like this. Can you confirm it again? And, I have to apologize for my poor English skill. Unfortunately, fromFor example, I want to retrieve the description of a div class called entry-content from the article link https://e-ficiencia.com/samsung-climate-solutions-acudira-cyr-2023/, I cannot understand your expected value. Can I ask you about your expected value?Your answer is not wrong, but it doesn't meet my expectations., I understood that my understanding of your question was not correct. In this case, I have to delete my answer. I deeply apologize for my poor English skill again. When I could correctly understand your question, I would like to think of a solution.