I am looking to build a scraper in google scripts. There are 2 classe with the same name and I can't find a way to get the second class. It only outputs the first one.
function myFunction() {
var url = "https://www.zchocolat.com/shop/fr/livraison-cadeau-chocolat/espagne";
var fromText = '<p class="article"';
var toText = '">';
var content = UrlFetchApp.fetch(url).getContentText();
var scraped = Parser
.data(content)
.setLog()
.from(fromText)
.to(toText)
.build();
Logger.log(scraped);
return scraped;
}
function SAVE_DATA() {
var sheet = SpreadsheetApp.openById('').getSheetByName('Feuille 1');
sheet.appendRow([ new Date(), myFunction() ]);
}
