{
  "slug": "html-extract",
  "name": "gizza-ai/html-extract",
  "version": "0.1.0",
  "title": "HTML Extractor — Pull Text & Attributes by CSS Selector — gizza.ai",
  "description": "Paste HTML, type a CSS selector, and pull out the text, inner/outer HTML, or an attribute from every match. Runs in your browser, nothing uploaded, free.",
  "tags": [
    "html extract",
    "css selector",
    "scrape html",
    "extract text",
    "get attribute",
    "inner html",
    "outer html",
    "jq for html"
  ],
  "category": "developer",
  "urls": {
    "page": "https://gizza.ai/tools/html-extract/",
    "markdown": "https://gizza.ai/tools/html-extract/index.md",
    "descriptor": "https://gizza.ai/tools/html-extract/tool.json",
    "deep_link_example": "https://gizza.ai/tools/html-extract/?html=%3Cul%3E%0A%20%20%3Cli%3E%3Ca%20href%3D%22%2Fone%22%3EFirst%3C%2Fa%3E%3C%2Fli%3E%0A%20%20%3Cli%3E%3Ca%20href%3D%22%2Ftwo%22%3ESecond%3C%2Fa%3E%3C%2Fli%3E%0A%3C%2Ful%3E&selector=a&extract=text&attr=href&limit=100&trim=true"
  },
  "cli": "gizza tool html-extract '<ul>\n  <li><a href=\"/one\">First</a></li>\n  <li><a href=\"/two\">Second</a></li>\n</ul>' 'selector=a'",
  "tool": {
    "description": "Run a CSS selector over pasted HTML and extract from every match. Set extract='text' (default, visible text), 'inner-html' (children as HTML), 'outer-html' (the element itself), or 'attr' plus an attr name (e.g. href) to read an attribute. limit caps matches (default 100, min 1); trim (default true) normalizes whitespace. Returns JSON with the match count and an array of values.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "attr": {
          "description": "Attribute name to read when extract=attr, e.g. href, src, or class. Required for attr mode; ignored otherwise.",
          "type": "string"
        },
        "extract": {
          "default": "text",
          "description": "What to pull from each match: text (visible text, default), inner-html (children as HTML), outer-html (the element itself as HTML), or attr (a named attribute's value).",
          "enum": [
            "text",
            "inner-html",
            "outer-html",
            "attr"
          ],
          "type": "string"
        },
        "html": {
          "description": "The raw HTML to search.",
          "type": "string"
        },
        "limit": {
          "default": 100,
          "description": "Maximum number of matches to return (default 100, minimum 1).",
          "minimum": 1,
          "type": "integer"
        },
        "selector": {
          "description": "A CSS selector, e.g. 'a.link', 'h2', or 'div#main > p'.",
          "type": "string"
        },
        "trim": {
          "default": true,
          "description": "Normalize whitespace: collapse runs of spaces/newlines in text and attributes and trim HTML ends. Default true.",
          "type": "boolean"
        }
      },
      "required": [
        "html",
        "selector"
      ],
      "type": "object"
    }
  }
}