Parsel is a library to extract data from HTML and XML using XPath and CSS selectors
Project Links
Meta
Author: Scrapy project
Requires Python: >=3.10
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
License
- OSI Approved :: BSD License
Natural Language
- English
Programming Language
- Python :: 3
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
- Python :: Implementation :: CPython
- Python :: Implementation :: PyPy
Topic
- Text Processing :: Markup
- Text Processing :: Markup :: HTML
- Text Processing :: Markup :: XML
Parsel is a BSD-licensed Python library to extract data from HTML, JSON, and XML documents.
It supports:
JMESPath expressions for JSON documents
Find the Parsel online documentation at https://parsel.readthedocs.org.
Example (open online demo):
>>> from parsel import Selector
>>> text = """
... <html>
... <body>
... <h1>Hello, Parsel!</h1>
... <ul>
... <li><a href="http://example.com">Link 1</a></li>
... <li><a href="http://scrapy.org">Link 2</a></li>
... </ul>
... <script type="application/json">{"a": ["b", "c"]}</script>
... </body>
... </html>"""
>>> selector = Selector(text=text)
>>> selector.css("h1::text").get()
'Hello, Parsel!'
>>> selector.xpath("//h1/text()").re(r"\w+")
['Hello', 'Parsel']
>>> for li in selector.css("ul > li"):
... print(li.xpath(".//@href").get())
...
http://example.com
http://scrapy.org
>>> selector.css("script::text").jmespath("a").get()
'b'
>>> selector.css("script::text").jmespath("a").getall()
['b', 'c']
1.11.0
Jan 29, 2026
1.10.0
Jan 17, 2025
1.9.1
Apr 08, 2024
1.9.0
Mar 14, 2024
1.8.1
Apr 18, 2023
1.7.0
Nov 01, 2022
1.6.0
May 07, 2020
1.5.2
Aug 09, 2019
1.5.1
Oct 25, 2018
1.5.0
Jul 03, 2018
1.4.0
Feb 08, 2018
1.3.1
Dec 28, 2017
1.2.0
May 17, 2017
1.1.0
Nov 22, 2016
1.0.3
Jul 29, 2016
1.0.2
Apr 26, 2016
1.0.1
Aug 24, 2015
1.0.0
Aug 23, 2015
0.9.6
Aug 14, 2015
0.9.5
Aug 11, 2015
0.9.4
Aug 10, 2015
0.9.3
Aug 07, 2015
0.9.2
Aug 07, 2015
0.9.1
Aug 04, 2015
0.9.0
Jul 30, 2015
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
cssselect
(>=1.2.0)
jmespath
(>=1.0.0)
lxml
(>=5.1.0)
packaging
(>=23.0)
w3lib
(>=1.19.0)