Co-authored-by: ilike2burnthing <59480337+ilike2burnthing@users.noreply.github.com>
7.9 KiB
SelectorBlock Schema
Cardigann#/definitions/SelectorBlock
Extracts a value from a response using a CSS selector (HTML) or path (JSON/XML), then applies case, remove and filters.
| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In |
|---|---|---|---|---|---|---|---|
| Can be instantiated | No | Unknown status | No | Forbidden | Forbidden | none | schema.json* |
SelectorBlock Type
object (SelectorBlock)
all of
SelectorBlock Properties
| Property | Type | Required | Nullable | Defined by |
|---|---|---|---|---|
| selector | string |
Optional | cannot be null | Cardigann indexer definition |
| attribute | string |
Optional | cannot be null | Cardigann indexer definition |
| optional | boolean |
Optional | cannot be null | Cardigann indexer definition |
| default | Merged | Optional | cannot be null | Cardigann indexer definition |
| case | object |
Optional | cannot be null | Cardigann indexer definition |
| remove | string |
Optional | cannot be null | Cardigann indexer definition |
| text | Merged | Optional | cannot be null | Cardigann indexer definition |
| filters | array |
Optional | cannot be null | Cardigann indexer definition |
selector
CSS selector for HTML, or path for JSON/XML. :has(), :not() and :contains() are supported. In JSON, $ refers to the root object and a .. prefix reads from the row instead of the rows attribute subset.
selector
-
is optional
-
Type:
string(Selector) -
cannot be null
-
defined in: Cardigann indexer definition
selector Type
string (Selector)
attribute
Take the value of this attribute (for example, href) instead of the element text.
attribute
-
is optional
-
Type:
string(Attribute) -
cannot be null
-
defined in: Cardigann indexer definition
attribute Type
string (Attribute)
optional
Do not fail if the selector does not match. Use with default.
optional
-
is optional
-
Type:
boolean(Optional) -
cannot be null
-
defined in: Cardigann indexer definition
optional Type
boolean (Optional)
default
Value used when an optional selector does not match. Templates are allowed, for example, "{{ .Result.title_default }}".
default
-
is optional
-
Type: merged type (Default)
-
cannot be null
-
defined in: Cardigann indexer definition
default Type
merged type (Default)
one (and only one) of
case
Selector: value pairs. The value of the first matching selector is used. "*" matches anything. Common for downloadvolumefactor and uploadvolumefactor.
case
-
is optional
-
Type:
object(Case (SelectorBlock)) -
cannot be null
-
defined in: Cardigann indexer definition
case Type
object (Case (SelectorBlock))
remove
Selector for elements to remove before reading the text. Removed elements are gone for all later fields, so put fields using remove last.
remove
-
is optional
-
Type:
string(Remove) -
cannot be null
-
defined in: Cardigann indexer definition
remove Type
string (Remove)
text
Fixed value, or a template. Used instead of selector, such as for minimumratio and minimumseedtime.
text
-
is optional
-
Type: merged type (Text)
-
cannot be null
-
defined in: Cardigann indexer definition
text Type
merged type (Text)
one (and only one) of
filters
Filters applied to the extracted value, in order.
filters
-
is optional
-
Type:
object[](FilterBlock) -
cannot be null
-
defined in: Cardigann indexer definition
filters Type
object[] (FilterBlock)