From a1c3179ec6cb053fd5a0e5f712eb40b02f3fc82e Mon Sep 17 00:00:00 2001 From: garfield69 Date: Tue, 21 Mar 2023 05:21:25 +1300 Subject: [PATCH] Updated Definition format (markdown) --- Definition-format.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Definition-format.md b/Definition-format.md index ce0b4fc..92123e8 100644 --- a/Definition-format.md +++ b/Definition-format.md @@ -636,6 +636,27 @@ In the event that you need to provide a default category due to the possibility selector: a.label[href*="type="] ``` +#### Providing other fields with a default value + +In the event that a field (other than category) might not be reliably present from the site results, you can use the `default` statement, as shown in these examples: + +```yaml + title_default: + # this title may be abbreviated + selector: a[href^="details.php?id="] + title: + # this title if present is full length + selector: a[title][href^="details.php?id="] + attribute: title + optional: true + default: "{{ .Result.title_default }}" + seeders: + # seeders may be missing + selector: a[href$="toseeders=1"] + optional: true + default: 0 +``` + ### Search JSON Example of a complex search block explaining all available options: