Checking for the existence of a Site (eg. checkurl in Python)

This snippet extracts data from the previous electronic medical record (https://karte.medley.life/*; select=ifneeded; selector=.KlxeCpDfqdtdJcyXPd0h > :nth-child(2) article div) In some cases, there may be no previous medical record (e.g., for a first visit). In that case, an error is returned.

I want to run the snippet only if there is a previous medical record.

How can I do this?

{p_record={site: text; page=https://karte.medley.life/*; select=ifneeded; selector=.KlxeCpDfqdtdJcyXPd0h > :nth-child(2) article div}}{bmi_measure=testregex({=p_record}, "身長") and testregex({=p_record}, "体重")}{if: bmi_measure}{run: `身長`=extractregex(p_record, "身長\D{0,8}([0-9]{1,5}(?:\.[0-9]{1,2})?)", "i")}{run: `体重`=extractregex(p_record, "体重\D{0,8}([0-9]{1,5}(?:\.[0-9]{1,2})?)", "i")}{endif}

Hi @N_Saito

In general you can handle errors in {site} command like so:

{if: catch({site: text}, "ERR") <> "ERR"}
Worked fine
{else}
Error occurred
{endif}

Let me know if this is what you were looking for.

@Gaurang_Tandon
Thanks, Perfect.