Inspired by such a convenience of Cheerio from this answer, I'm trying to use it in the following codes. The codes was able to pull any table data by calling class="snapshot-td2", but I'm interested in getting only those in the first table. How can I do that? The URL has two tables having class="snapshot-td2". And it retrieved them in string. How can I get them in array? Thank you for any help!
function test() {
const url = 'https://finviz.com/quote.ashx?t=AFRM';
const res = UrlFetchApp.fetch(url, { muteHttpExceptions: true }).getContentText();
const page = Cheerio.load(res);
// The next line returned the tableValue from two tables of having class="snapshot-td2".
// What should be modified to get the tableValue only from the first table?
// The next line returned the tableValue in string. What should be modified to get them in array?
var tableValue = page('.snapshot-td2').text();
console.log(tableValue);
}