{
 "kind": "api",
 "slug": "cheerio",
 "path": "apis/cheerio/",
 "name": "Cheerio",
 "logo": "https://agentgid.com/media/avatars/cheeriojs.png",
 "maker": "Cheerio (open source project)",
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "Scraping and crawling",
   "apis/scraping/"
  ]
 ],
 "lead": "Read and change web page code in JavaScript.",
 "chips": [
  {
   "label": "Scraping and crawling",
   "path": "apis/scraping/"
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Use cheerio 1.2.0 on the server: load the HTML, read the products with $.extract into a list of { name, price, link }, set baseURI so links are absolute, and never pass a user-typed URL or selector straight in."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://cheerio.js.org"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/cheeriojs/cheerio"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Open source",
   "status": "yes",
   "sub": "Run it yourself for free",
   "quote": null,
   "note": "No free tier on the pricing page. As reported on the official pricing page, checked Oct 10, 2026.",
   "src": "https://cheerio.js.org"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "Allowed",
   "status": "yes",
   "sub": null,
   "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software",
   "note": "MIT allows use in paid products free of charge.",
   "src": "https://github.com/cheeriojs/cheerio/blob/main/LICENSE"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key",
   "status": "info",
   "sub": "Env var none",
   "quote": "Only load is available in the browser.",
   "note": "None. It is a library that runs in your own code; there is no account, key or Cheerio service.",
   "src": "https://cheerio.js.org/docs/basics/loading"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "info",
   "sub": "SDK",
   "quote": null,
   "note": " Our agent check: 2 of 6 (Nov 13, 2026).",
   "src": "https://cheerio.js.org"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Oct 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Cheerio does",
   "parts": [
    {
     "t": "prose",
     "text": "Cheerio is a free, open-source code library, not an online service. Your app or script gives it the code of a web page and gets back exactly the parts it asks for, such as product names, prices or links. It can also change that page code, and it runs inside your own program, with no account and no key."
    },
    {
     "t": "list",
     "items": [
      "Cheerio is one of 25 APIs in the Scraping and crawling category on AgentGid.",
      "It is one of 20 that can be started for free.",
      "12 of them ship an official MCP server; Cheerio does not.",
      "Its official SDK is the 1st most downloaded in the category (37.2M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Pull prices and names from a page",
       "text": "Read a shop or catalog page your script has downloaded and get each product's name, price and link as a neat list.",
       "idea": false
      },
      {
       "title": "Turn repeated blocks into records",
       "text": "A page lists many similar blocks, like releases, jobs or reviews; describe one block once and get every block back as a record.",
       "idea": false
      },
      {
       "title": "Change page code before saving it",
       "text": "Edit an HTML template or e-mail on the server, for example replace a heading or add a class, then save the result.",
       "idea": false
      },
      {
       "title": "Read a sitemap or feed",
       "text": "Load an XML file such as a sitemap or news feed from a web address and list its entries.",
       "idea": false
      },
      {
       "title": "Clean page text for an AI assistant",
       "text": "Take only the readable text of an article, without scripts and styles, before sending it to a chat model to summarize.",
       "idea": true
      },
      {
       "title": "Check your own pages before publishing",
       "text": "In a build step, scan every generated page for images without alt text or pages without a title.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Cheerio popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "37.4M",
       "l": "SDK downloads a week",
       "d": "+35.8% on the 4-week average",
       "up": true
      },
      {
       "n": "305",
       "l": "public agent repos use its SDK"
      },
      {
       "n": "30.6K",
       "l": "GitHub stars, cheeriojs/cheerio"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "None"
      },
      {
       "l": "Cheapest plan",
       "v": "No monthly plan"
      },
      {
       "l": "Usage price",
       "v": "—"
      },
      {
       "l": "Plans",
       "v": "Library, not a hosted API: free to use, does not fetch or render JavaScript itself."
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Oct 10, 2026. Prices change: confirm before you buy.",
     "link": "",
     "href": null
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "None. It is a library that runs in your own code; there is no account, key or Cheerio service."
      },
      {
       "l": "Environment variable",
       "v": "none",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "Yes",
       "status": "yes"
      },
      {
       "l": "Card at sign-up",
       "v": "No"
      }
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "Free for any use, including paid products and client work, under the MIT license. Keep the copyright and license notice with copies of the code; no visible credit is needed."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "Yes",
       "status": "yes",
       "sub": "MIT allows use in paid products free of charge.",
       "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software",
       "src": "https://github.com/cheeriojs/cheerio/blob/main/LICENSE"
      },
      {
       "l": "inside-app-bundle",
       "v": "With conditions",
       "status": "cond",
       "sub": "Shipping the code inside your app is allowed if the MIT copyright and permission notice stays with it.",
       "quote": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.",
       "src": "https://github.com/cheeriojs/cheerio/blob/main/LICENSE"
      },
      {
       "l": "client-work",
       "v": "Yes",
       "status": "yes",
       "sub": "MIT places no limit on who you build for.",
       "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software",
       "src": "https://github.com/cheeriojs/cheerio/blob/main/LICENSE"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Error: Unknown pseudo-class :focus",
       "v": "The selector uses a browser-only state (:focus, :target, :lang) that Cheerio does not support.",
       "sub": "Remove that part of the selector; match on structure, classes or data- attributes instead."
      },
      {
       "l": "ResponseError (fromURL)",
       "v": "The website answered with a non-2xx status, such as 404 or 500.",
       "sub": "Read the status code on the error; retry later for 5xx, fix the address for 404."
      },
      {
       "l": "RangeError (fromURL)",
       "v": "The address returned something that is not HTML or XML, such as a PDF.",
       "sub": "Check the address; handle other file types with another tool."
      },
      {
       "l": "method must be a string",
       "v": "requestOptions was passed to fromURL without a method.",
       "sub": "Add method: 'GET' to requestOptions."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "2 of 6: llms.txt no, OpenAPI no, SDK yes, MCP no, status page no, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "None found",
       "sub": null
      },
      {
       "l": "npm",
       "v": "npm install cheerio",
       "code": true
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Cheerio",
       "me": true,
       "facts": [
        "Free (open source)",
        "No free tier"
       ]
      },
      {
       "name": "Firecrawl",
       "why": "Pick Firecrawl when you want a hosted service that also opens script-heavy pages and returns clean text for AI; our catalog lists about $5 per 1,000 pages (list price on 2026-11-10).",
       "path": "apis/firecrawl/",
       "facts": [
        "See its page",
        "No free tier"
       ]
      },
      {
       "name": "Crawl4AI",
       "why": "Pick Crawl4AI for an open-source crawler that renders pages and writes AI-friendly text, run yourself or as a hosted service.",
       "path": "apis/crawl4ai/",
       "facts": [
        "$0.5 / 1k requests",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "Apify",
       "why": "Pick Apify when you want ready-made scrapers for popular sites plus hosting and proxies, instead of writing selectors.",
       "path": "apis/apify/",
       "facts": [
        "See its page",
        "No free tier"
       ]
      }
     ],
     "more": "All scraping and crawling APIs",
     "more_path": "apis/scraping/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use cheerio 1.2.0 on the server: load the HTML, read the products with $.extract into a list of { name, price, link }, set baseURI so links are absolute, and never pass a user-typed URL or selector straight in."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add Cheerio to a Node.js project.",
       "code": "npm install cheerio",
       "src": "https://cheerio.js.org/docs/intro"
      },
      {
       "text": "Load the page code with load, then select elements with CSS selectors, like in jQuery.",
       "code": "import * as cheerio from 'cheerio';\nconst $ = cheerio.load('<h2 class=\"title\">Hello world</h2>');\n$('h2.title').text(); // \"Hello world\"",
       "src": "https://cheerio.js.org/docs/intro"
      },
      {
       "text": "To have Cheerio download the page itself, use fromURL and await it (Node.js only).",
       "code": "import * as cheerio from 'cheerio';\nconst $ = await cheerio.fromURL('https://example.com');",
       "src": "https://cheerio.js.org/docs/basics/loading"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "import * as cheerio from 'cheerio';\nconst $ = cheerio.load('<h2 class=\"title\">Hello world</h2>');\n\n$('h2.title').text('Hello there!');\n$('h2').addClass('welcome');\n\n$.html();",
       "intro": "Cheerio is a library, not a hosted service; this is the smallest example from its home page and README, and our demo ran the same calls."
      },
      {
       "tab": "Response",
       "code": "//=> <html><head></head><body><h2 class=\"title welcome\">Hello there!</h2></body></html>"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Using Cheerio on a site whose content is drawn by React or Vue in the browser, then reading empty results as \"no data\".",
       "fix": "Check $.html() first; if you see an empty root div and a script bundle, render the page with Playwright or Puppeteer and pass that HTML to Cheerio.",
       "why": "Cheerio does not run scripts, so content built in the browser is not in the HTML it got."
      },
      {
       "dont": "$('#greeting').html(`Hello, ${name}`) with text typed by a user",
       "fix": "$('#greeting').text(`Hello, ${name}`)",
       "why": "html() and other insert methods parse their input as markup, so user text can inject tags; text() escapes it."
      },
      {
       "dont": "$(`[data-id=\"${id}\"]`) with an id from user input or scraped data",
       "fix": "$('[data-id]').filter((_, el) => $(el).attr('data-id') === id)",
       "why": "A quote in the value breaks out of the selector; Cheerio has no CSS.escape."
      },
      {
       "dont": "cheerio.fromURL(url, { requestOptions: { headers: { ... } } })",
       "fix": "Always include method: 'GET' in requestOptions, and repeat the Accept header if you set headers.",
       "why": "requestOptions has no default method, and your headers replace Cheerio's defaults instead of adding to them."
      },
      {
       "dont": "$('li').text() to get each item",
       "fix": "$('li').map((i, el) => $(el).text()).get()",
       "why": "text() on many elements joins them into one run-on string with no separator."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Do I need an account or a key?",
       "a": "No. Cheerio is a code library you install; nothing is sent to a Cheerio service.",
       "evidence": {
        "url": "https://cheerio.js.org/docs/advanced/security",
        "quote": "It never executes scripts, evaluates expressions, or touches the network - the one exception being fromURL"
       }
      },
      {
       "q": "Why is my selection empty on some sites?",
       "a": "The content is probably built by the page's scripts, which Cheerio does not run. Check the HTML you received; for such pages use Puppeteer or Playwright.",
       "evidence": {
        "url": "https://cheerio.js.org/docs/basics/troubleshooting",
        "quote": "If the markup you're looking for is built client-side by React, Vue, or similar, it isn't in the HTML Cheerio received."
       }
      },
      {
       "q": "Can I use it in a commercial product?",
       "a": "Yes. It is MIT licensed; keep the license notice with copies of the code.",
       "evidence": {
        "url": "https://github.com/cheeriojs/cheerio/blob/main/LICENSE",
        "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software"
       }
      },
      {
       "q": "Does it work in the browser?",
       "a": "Yes, with the load function only; fetching and stream loaders need Node.js.",
       "evidence": {
        "url": "https://cheerio.js.org/docs/basics/loading",
        "quote": "Only load is available in the browser."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "Cheerio (open source project)"
  ],
  [
   "Category",
   "Scraping and crawling"
  ],
  [
   "Price",
   "Free (open source)"
  ],
  [
   "Official SDK",
   "npm cheerio"
  ],
  [
   "Latest SDK",
   "1.2.0 on npm"
  ],
  [
   "Agent check",
   "2 of 6"
  ],
  [
   "Pricing checked",
   "Oct 10, 2026"
  ]
 ],
 "good": [
  "It does not run the page's scripts. Content that a site builds in the browser will be missing; use a real browser tool like Playwright for those sites.",
  "It does not make page code safe. Clean scraped code with a sanitizer before you show it on your own site.",
  "Version 1.2.0 needs Node.js 20.18.1 or newer; the docs already state 22.19 or newer for the next version."
 ],
 "checked_line": "Read by AgentGid from 15 official pages, card checked Nov 10, 2026; usage numbers update daily."
}