Extraction rules — CSS / XPath / regex / JSON-LD / API JSON
#Which to pick
| Method | Best for | Stability |
|---|---|---|
| CSS selector | Plain elements like .price #stock | Breaks on redesigns, but easiest to write |
| XPath | Structural targeting like //span[@class='price'] | More expressive than CSS |
| Regex | Content without a clean tag wrapper | Last resort — use carefully |
| JSON-LD | Pages with built-in structured data (offers.price, etc.) | Most stable — check for it first |
| API JSON | Pull the field straight from the XHR API when data loads from one | Stable and bandwidth-friendly |
Check JSON-LD first
Most e-commerce and content sites embed JSON-LD structured data with canonical field names (like offers.price) — far more stable than scraping visual elements. Pick JSON-LD in the form and fill in the field path directly.
#Writing tips
- For each monitor, target the smallest possible scope: extract just the price element rather than the whole product card — the bigger the scope, the more unrelated churn you capture.
- Test rule returns the currently extracted value and its snippet; trust the test result, not a selector that merely looks right.
- If page fetches get rejected, switch the fetch channel — see Advanced: fetch channels.
Related: Create with the wizard · Watch can't fetch content