Some Help With the New Jsoup in $wg()$?

Ok, got the beta from the downloads page. Thanks!

I am especially interested in the jsoup option for $wg()$.

I understand the example. But am still a jsoup newbie (in the extreme)…

So I wonder, given the following html snippet, how to extract the table row data?

<table id="recent-calls" class="table table-hover table-sm table-responsive-sm" width="100%">

<thead>

<tr>

<th>Time</th>

<th>Caller</th>

<th>Actions</th>

</tr>

</thead>

<tbody>

<tr class="">

<td class="time">

<b>12:08 PM</b>

<span class="d-md-none"><br></span>

13-Mar-24

</td>

<td class="phoneno">

<a href="/calls/view/314">

<b>360-491-3492</b>

</a>

<span class="d-md-none"><br></span>

<span class="text-break pl-md-2 pl-lg-3"><i>LACEY,WA</i></span>

</td>

<td>

<span class="badge badge-info">

Screened

</span>

<span>

</span>

</td>

</tr>

<tr class="">

<td class="time">

<b>09:43 AM</b>

<span class="d-md-none"><br></span>

13-Mar-24

</td>

<td class="phoneno">

<a href="/calls/view/313">

<b>360-249-0004</b>

</a>

<span class="d-md-none"><br></span>

<span class="text-break pl-md-2 pl-lg-3"><i>WASHINGTON CALL</i></span>

</td>

<td>

<span class="badge badge-info">

Screened

</span>

<span>

</span>

</td>

</tr>

</tbody>

</table>

I have tried a number of selectors online and it seems that

table#recent-calls

returns the entire table and that

tr[class='']

gets the rows I want. But I am hoping to get the table row data for all of the rows. So I am really not sure how to proceed, what to use for the last argument to the $wg()$ or even if the jsoup stuff can handle the processing of multiple matching items.

So any further discussion/description will be a real help. Thanks

Havent tested but did you try something like:

table#recent-calls tbody tr td.phoneno b

To select the phone number text? This just follows the document structure, you can then use different wg() calls to get the other fields.

So something like:
$wg(url, jsoup, "table#recent-calls tbody tr td.phoneno b")$

Thanks Frank!

In doing some more fiddling, I have actually gotten somewhere. In so doing, I discovered that specifying this in the editor (say as text for a text field) does not populate the text preview until the formula is actually saved - when it does update. At least this is what I see on the first edit of the wg() - it seems that subsequent changes update immediately. I guess this is the same for all wg() but I never quite noticed it before.

Anyhow, in using the selector given above, I DO get a result. It appears that I only get the value from the 1st table row. If I just get down to the tbody level, I get the entire table. To get the first row, I can go to the tr level. So things are consistent.

In my case, I would not want to issue wg() again and again for each row (not to mention element) so getting the tbody seems closest to what I need. I do note, however, that there do not seem to be any delimiters between the tr or the td elements. It appears to be all one big, kind of unhelpful string.

I guess I will just stick with plain old wg() and hack the data apart using regex’es. I had hoped that jsoup would have been more elegant (easier).

Thanks