{"id":"heal-scraper","title":"Self-Healing Scraper & DOM-to-JSON Compiler","description":"Synthesizes durable CSS selectors (Cheerio; no XPath) for a target JSON schema, proves them against the live DOM in-request, and returns the extracted data plus a ready-to-run TypeScript Cheerio extractor.","roi":"Pay once when a scraper breaks instead of paying for LLM extraction on every page; the returned extractor runs deterministically for free.","audience":"developer","channels":["x402","mcp","rapidapi","apify"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/heal-scraper","path":"/api/v1/heal-scraper","contentType":"application/json"},"price":{"amount":"0.40","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"required":["targetSchema"],"properties":{"url":{"type":"string","maxLength":2048,"description":"Page to fetch. Provide url or html."},"html":{"type":"string","maxLength":1500000,"description":"Raw HTML to use instead of fetching."},"targetSchema":{"type":"object","description":"JSON Schema of the fields to extract: an object whose properties are string/number/integer/boolean (or arrays of those), or an array whose items are such an object for list pages. The pattern keyword is not allowed."},"previousBrokenSelectors":{"type":"object","description":"Map of field name to the CSS selector that stopped working."}}},"resultSchema":{"type":"object","properties":{"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Final fetched URL, or null when html was supplied."},"healed":{"type":"boolean","description":"True when every field fills at least 4 in 5 records (single record: filled) and the data validates against targetSchema."},"decidedBy":{"type":"string","enum":["previous_selectors","repaired_selectors","structured_markup","llm"],"description":"Which stage produced the returned spec; all but llm make no model call. With llm, only the fields in llmFields were sent to the model."},"deterministic":{"type":"boolean","description":"True when no model call was made: replay, cosmetic repair, or structured markup satisfied the schema."},"llmCalls":{"type":"integer"},"llmFields":{"type":"array","items":{"type":"string"},"description":"Fields the model was asked to solve (empty when deterministic)."},"repairs":{"type":"array","description":"Previous selectors changed to survive cosmetic drift: hashed or utility classes, :nth-child positions.","items":{"type":"object","properties":{"field":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"strategy":{"type":"string"}}}},"data":{"description":"Extracted data shaped like targetSchema."},"selectorMap":{"type":"object"},"spec":{"type":"object"},"validation":{"type":"object"},"extractorCode":{"type":"string","description":"Standalone TypeScript module exporting extract(html)."},"page_structure_notes":{"type":"string"}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Final fetched URL, or null when html was supplied."},"healed":{"type":"boolean","description":"True when every field fills at least 4 in 5 records (single record: filled) and the data validates against targetSchema."},"decidedBy":{"type":"string","enum":["previous_selectors","repaired_selectors","structured_markup","llm"],"description":"Which stage produced the returned spec; all but llm make no model call. With llm, only the fields in llmFields were sent to the model."},"deterministic":{"type":"boolean","description":"True when no model call was made: replay, cosmetic repair, or structured markup satisfied the schema."},"llmCalls":{"type":"integer"},"llmFields":{"type":"array","items":{"type":"string"},"description":"Fields the model was asked to solve (empty when deterministic)."},"repairs":{"type":"array","description":"Previous selectors changed to survive cosmetic drift: hashed or utility classes, :nth-child positions.","items":{"type":"object","properties":{"field":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"strategy":{"type":"string"}}}},"data":{"description":"Extracted data shaped like targetSchema."},"selectorMap":{"type":"object"},"spec":{"type":"object"},"validation":{"type":"object"},"extractorCode":{"type":"string","description":"Standalone TypeScript module exporting extract(html)."},"page_structure_notes":{"type":"string"}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"url":"https://news.ycombinator.com","targetSchema":{"type":"array","items":{"type":"object","required":["title","link"],"properties":{"title":{"type":"string"},"link":{"type":"string"},"points":{"type":"integer"}}}},"previousBrokenSelectors":{"title":".storylink"}},"openapiOperation":{"operationId":"heal_scraper","summary":"Self-Healing Scraper & DOM-to-JSON Compiler","description":"Synthesizes durable CSS selectors (Cheerio; no XPath) for a target JSON schema, proves them against the live DOM in-request, and returns the extracted data plus a ready-to-run TypeScript Cheerio extractor.\n\nPrice: 0.40 USDC on Base (x402).","x-x402-price-usdc":"0.40","x-x402-amount":"400000","x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"0.40"}},"x-audience":"developer","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/heal-scraper","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["targetSchema"],"properties":{"url":{"type":"string","maxLength":2048,"description":"Page to fetch. Provide url or html."},"html":{"type":"string","maxLength":1500000,"description":"Raw HTML to use instead of fetching."},"targetSchema":{"type":"object","description":"JSON Schema of the fields to extract: an object whose properties are string/number/integer/boolean (or arrays of those), or an array whose items are such an object for list pages. The pattern keyword is not allowed."},"previousBrokenSelectors":{"type":"object","description":"Map of field name to the CSS selector that stopped working."}}},"example":{"url":"https://news.ycombinator.com","targetSchema":{"type":"array","items":{"type":"object","required":["title","link"],"properties":{"title":{"type":"string"},"link":{"type":"string"},"points":{"type":"integer"}}}},"previousBrokenSelectors":{"title":".storylink"}}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Final fetched URL, or null when html was supplied."},"healed":{"type":"boolean","description":"True when every field fills at least 4 in 5 records (single record: filled) and the data validates against targetSchema."},"decidedBy":{"type":"string","enum":["previous_selectors","repaired_selectors","structured_markup","llm"],"description":"Which stage produced the returned spec; all but llm make no model call. With llm, only the fields in llmFields were sent to the model."},"deterministic":{"type":"boolean","description":"True when no model call was made: replay, cosmetic repair, or structured markup satisfied the schema."},"llmCalls":{"type":"integer"},"llmFields":{"type":"array","items":{"type":"string"},"description":"Fields the model was asked to solve (empty when deterministic)."},"repairs":{"type":"array","description":"Previous selectors changed to survive cosmetic drift: hashed or utility classes, :nth-child positions.","items":{"type":"object","properties":{"field":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"strategy":{"type":"string"}}}},"data":{"description":"Extracted data shaped like targetSchema."},"selectorMap":{"type":"object"},"spec":{"type":"object"},"validation":{"type":"object"},"extractorCode":{"type":"string","description":"Standalone TypeScript module exporting extract(html)."},"page_structure_notes":{"type":"string"}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://agents.writerslogic.com/docs/heal-scraper/","docsJson":"https://agents.writerslogic.com/docs/heal-scraper.json","sample":"https://agents.writerslogic.com/api/v1/samples/heal-scraper","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://agents.writerslogic.com/docs/index.json"}}