Home > Mobile >  Extract text from a line that is between two elements using Cheeriogs
Extract text from a line that is between two elements using Cheeriogs

Time:09-17

The Cheeriogs library (1ReeQ6WO8kKNxoaA_O0XEQ589cIrRvEBA9qcWpNqdOP17i47u6N9M5Xh0) for Google App Script is in this GitHub repository:
enter image description here

For this I'm trying to use the following path:

$('td > p br:nth-child(2)');
sheet.getRange(1,1).setValue($(element).nextSibling.text().trim());

From what I understand in other questions answered here in the community, I should use nextSibling so that when extracting it it looks for the first value after the <br> tag indicated, but my attempt returned a blank value.

How should I proceed in these cases in order to collect the desired amount?

CodePudding user response:

Will this suffice?

$(str).children()[2].next.data.trim()

test

First time using cheerio so please correct me if i'm wrong.

  • Related