after_extraction is an ordered list of transformations applied to a selector's value. Each entry has a method and an optional params string whose format depends on the method; ### is the separator wherever one is needed.
"after_extraction": [
{ "method": "INSERT_CHAR_FROM_END_AT_INDEX", "params": ".###2" },
{ "method": "MERGE_WITH_EXTRACTED", "params": "%ropo% TRY" }
]Where it works
after_extraction reaches the engine only through create_template_selector and update_template_selector. An equivalent field on scrape_unblocker's inline selectors is dropped upstream and never persists, so the scrape appears to succeed with untransformed values. To format values from an API, create the config first (one scrape_unblocker call), then add or update its selectors through the template tools.
Methods
MERGE_WITH_EXTRACTED— put the value into a template, marking its place with%ropo%. Turns a slug into a full link:https://www.example.com/%ropo%.INSERT_CHAR_FROM_END_AT_INDEX— insert a character N positions from the end. Turns minor-unit prices into decimals:,###2makes8750into87,50;.###2gives87.50.REPLACE_ALL—old###new; replaces every occurrence.REMOVE_ALL—paramsis the substring to delete.REPLACE_LAST—target###replacement; only the last occurrence.SPLIT_BEFORE/SPLIT_AFTER—paramsis the delimiter; keeps the part before or after it.EXTRACT_WITH_REGEX—paramsis the pattern; returns what it matches.IF_EQUALS_X_SET_Y_ELSE_Z—x,y,z; if the value equals x return y, otherwise z.DEFAULT_VALUE— replaces the value withparamsoutright.BASE64_DECODE— no params.UNQOUTE— no params. The spelling is the engine's.ITERATE_URL— builds the next page's URL from this one.<param>=###<step>###<max>, e.g.sayfa=###1###50walks?sayfa=1to?sayfa=50one at a time and returns empty once past the max.ITERATE_BODY— the same idea for a paging value carried in the request body.
Worked examples
A relative product link into an absolute URL:
{
"name": "create_template_selector",
"arguments": {
"apiKey": "js_YOUR_API_KEY",
"configId": 4412,
"property_name": "url[]",
"selector": "products.slug",
"attribute_type": "JSON",
"after_extraction": [
{ "method": "MERGE_WITH_EXTRACTED", "params": "https://shop.example.com/p/%ropo%" }
]
}
}A price in kuruş into lira with two decimals:
{
"name": "create_template_selector",
"arguments": {
"apiKey": "js_YOUR_API_KEY",
"configId": 4412,
"property_name": "price[]",
"selector": "products.price.amountMinor",
"attribute_type": "JSON",
"after_extraction": [
{ "method": "INSERT_CHAR_FROM_END_AT_INDEX", "params": ",###2" }
]
}
}Earlier tool versions offered TRIM, TO_LOWER and TO_UPPER. They do not exist in the engine: sending one is not an error, the value simply comes back untouched. They have been removed from the schema so a caller cannot "trim" a field and be told nothing.