This project is a branch of parsel on QPython.
Parsel is a BSD-licensed Python_ library to extract data from HTML_, JSON_, and XML_ documents.
It supports:
-
CSS_ and XPath_ expressions for HTML and XML documents
-
JMESPath_ expressions for JSON documents
-
Regular expressions_
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']
Release files for parsel-qpython 1.9.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| parsel_qpython-1.9.1.2.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| parsel_qpython-1.9.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.7 kB
Release files / parsel_qpython-1.9.1.2.tar.gz
| Download URL | parsel_qpython-1.9.1.2.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2758290b89f103146a4498a9b2bb9bcb527f677c1e7af7da6140b297b96db35a
|
|
BLAKE2b-256 checksum How to use checksums |
7afe2feb0c36b8dd841340871de963b31cccb86064f66ca82b6de4583931c223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / parsel_qpython-1.9.1.2-py3-none-any.whl
| Download URL | parsel_qpython-1.9.1.2-py3-none-any.whl |
|---|---|
| Size | 13.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ee2d5701cc7050ea7f07a5b89b929d6716c6cf34b01c79d7a359ba41bcabcdc
|
|
BLAKE2b-256 checksum How to use checksums |
b241d409a98943714dd10082e420a4f021bb0d394172d780072526e5276a8211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|