--- id: parsel version: "1.11.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # parsel — Parsel is a library to extract data from HTML and XML using XPath and CSS selectors License: permissive · Maintenance: active · Downloads: 4.9M/mo ## What it is and what it does Parsel is a data extraction library that wraps HTML, JSON, and XML documents in a unified selector interface. It lets you query documents using CSS selectors and XPath expressions for markup, JMESPath for JSON, and regular expressions across all formats. The library is commonly used in web scraping pipelines and data processing workflows where you need to pull structured information from semi-structured documents. The package depends on lxml for markup parsing, cssselect for CSS-to-XPath translation, jmespath for JSON queries, w3lib for URL/encoding utilities, and packaging for version handling. It supports modern Python versions (3.10 through 3.14) and both CPython and PyPy implementations. The API is straightforward: create a Selector from text, then chain method calls like .css() or .xpath() to navigate and extract data. Use it for: - Web scraping: extract product names, prices, and links from e-commerce HTML pages. - API response parsing: pull nested data from JSON responses using JMESPath expressions. - XML document processing: extract fields from structured XML feeds or configuration files. - Data cleaning pipelines: apply CSS or XPath rules to normalize and extract text from HTML documents. - Testing web scrapers: validate that selectors correctly target expected elements before deploying. - Log or markup analysis: search and extract patterns from HTML or XML logs using regular expressions. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parsel extracts data from HTML, JSON, and XML documents using CSS selectors, XPath expressions, JMESPath queries, and regular expressions. Yes. Parsel is actively maintained, widely used (top 5000 PyPI), has no known vulnerabilities, and offers a clean API for a common task. Install it if you need to extract data from HTML, XML, or JSON documents in a Python application. The low install friction and permissive license make it a straightforward choice. ## Install pip install parsel uv add parsel poetry add parsel ## Installing parsel Before you install: Low friction install with five runtime dependencies (cssselect, jmespath, lxml, packaging, w3lib). Active maintenance with recent commits and stable production status. License in practice: BSD-3-Clause permissive license allows commercial and private use with minimal restrictions. Quickstart: pip install parsel from parsel import Selector text = '