selectolax 0.4.4__cp310-cp310-macosx_10_9_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: selectolax
3
+ Version: 0.4.4
4
+ Summary: A fast HTML5 parser with CSS selectors, written in Cython, using Modest and Lexbor engines.
5
+ Home-page: https://github.com/rushter/selectolax
6
+ Author: Artem Golubin
7
+ Author-email: Artem Golubin <me@rushter.com>
8
+ License-Expression: MIT
9
+ Project-URL: Homepage, https://github.com/rushter/selectolax
10
+ Project-URL: Repository, https://github.com/rushter/selectolax
11
+ Project-URL: Documentation, https://selectolax.readthedocs.io/en/latest/parser.html
12
+ Project-URL: Changelog, https://github.com/rushter/selectolax/blob/master/CHANGES.md
13
+ Keywords: selectolax,html,parser,css,fast,lexbor,modest
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Environment :: Web Environment
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Natural Language :: English
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Operating System :: Unix
22
+ Classifier: Programming Language :: Cython
23
+ Classifier: Programming Language :: Python
24
+ Classifier: Programming Language :: Python :: 3
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Programming Language :: Python :: 3.9
27
+ Classifier: Programming Language :: Python :: 3.10
28
+ Classifier: Programming Language :: Python :: 3.11
29
+ Classifier: Programming Language :: Python :: 3.12
30
+ Classifier: Programming Language :: Python :: 3.13
31
+ Classifier: Programming Language :: Python :: 3.14
32
+ Classifier: Programming Language :: Python :: Implementation :: CPython
33
+ Classifier: Topic :: Internet
34
+ Classifier: Topic :: Internet :: WWW/HTTP
35
+ Classifier: Topic :: Software Development
36
+ Classifier: Topic :: Software Development :: Libraries
37
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
38
+ Classifier: Topic :: Text Processing
39
+ Classifier: Topic :: Text Processing :: Markup
40
+ Classifier: Topic :: Text Processing :: Markup :: HTML
41
+ Classifier: Typing :: Typed
42
+ Requires-Python: <3.15,>=3.9
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Provides-Extra: cython
46
+ Requires-Dist: Cython; extra == "cython"
47
+ Dynamic: author
48
+ Dynamic: home-page
49
+ Dynamic: license-file
50
+
51
+ ![selectolax logo](docs/logo.png)
52
+
53
+ ---
54
+
55
+ A fast HTML5 parser with CSS selectors, written in Cython,
56
+ using [Modest](https://github.com/lexborisov/Modest/) and [Lexbor](https://github.com/lexbor/lexbor) engines.
57
+
58
+ ---
59
+
60
+ [![PyPI - Version](https://img.shields.io/pypi/v/selectolax?logo=pypi&label=Pypi&logoColor=fff)](https://pypi.org/project/selectolax)
61
+ [![PyPI Total Downloads](https://static.pepy.tech/badge/selectolax)](https://pepy.tech/projects/selectolax)
62
+ [![CI](https://img.shields.io/github/actions/workflow/status/rushter/selectolax/pythonpackage.yml?branch=master&logo=githubactions&label=CI)](https://github.com/rushter/selectolax/actions/workflows/pythonpackage.yml?query=branch%3Amaster+event%3Apush)
63
+ [![Python Versions](https://img.shields.io/pypi/pyversions/selectolax?logo=python&logoColor=fff&label=Python)](https://pypi.org/project/selectolax)
64
+ [![GitHub License](https://img.shields.io/github/license/rushter/selectolax?logo=github&label=License)](https://github.com/rushter/selectolax/blob/master/LICENSE)
65
+
66
+ ---
67
+
68
+ ## Installation
69
+
70
+ From PyPI using pip:
71
+
72
+ ```bash
73
+ pip install selectolax
74
+ ```
75
+
76
+ If installation fails due to compilation errors, you may need to install [Cython](https://github.com/cython/cython):
77
+
78
+ ```bash
79
+ pip install selectolax[cython]
80
+ ```
81
+
82
+ This usually happens when you try to install an outdated version of selectolax on a newer version of Python.
83
+
84
+ Development version from GitHub:
85
+
86
+ ```bash
87
+ git clone --recursive https://github.com/rushter/selectolax
88
+ cd selectolax
89
+ pip install -r requirements_dev.txt
90
+ python setup.py install
91
+ ```
92
+
93
+ How to compile selectolax while developing:
94
+
95
+ ```bash
96
+ make clean
97
+ make dev
98
+ ```
99
+
100
+ ## Basic examples
101
+
102
+ Here are some basic examples to get you started with selectolax:
103
+
104
+ Parsing HTML and extracting text:
105
+
106
+ ```python
107
+ In [1]: from selectolax.lexbor import LexborHTMLParser
108
+ ...:
109
+ ...: html = """
110
+ ...: <h1 id="title" data-updated="20201101">Hi there</h1>
111
+ ...: <div class="post">Lorem Ipsum is simply dummy text of the printing and typesetting industry. </div>
112
+ ...: <div class="post">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
113
+ ...: """
114
+ ...: tree = LexborHTMLParser(html)
115
+
116
+ In [2]: tree.css_first('h1#title').text()
117
+ Out[2]: 'Hi there'
118
+
119
+ In [3]: tree.css_first('h1#title').attributes
120
+ Out[3]: {'id': 'title', 'data-updated': '20201101'}
121
+
122
+ In [4]: [node.text() for node in tree.css('.post')]
123
+ Out[4]:
124
+ ['Lorem Ipsum is simply dummy text of the printing and typesetting industry. ',
125
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.']
126
+ ```
127
+
128
+ ### Using advanced CSS selectors
129
+
130
+ ```python
131
+ In [1]: html = "<div><p id=p1><p id=p2><p id=p3><a>link</a><p id=p4><p id=p5>text<p id=p6></div>"
132
+ ...: selector = "div > :nth-child(2n+1):not(:has(a))"
133
+
134
+ In [2]: for node in LexborHTMLParser(html).css(selector):
135
+ ...: print(node.attributes, node.text(), node.tag)
136
+ ...: print(node.parent.tag)
137
+ ...: print(node.html)
138
+ ...:
139
+ {'id': 'p1'} p
140
+ div
141
+ <p id="p1"></p>
142
+ {'id': 'p5'} text p
143
+ div
144
+ <p id="p5">text</p>
145
+ ```
146
+
147
+ #### Using `lexbor-contains` CSS pseudo-class to match text
148
+
149
+ ```python
150
+ from selectolax.lexbor import LexborHTMLParser
151
+ html = "<div><p>hello </p><p id='main'>lexbor is AwesOme</p></div>"
152
+ parser = LexborHTMLParser(html)
153
+ # Case-insensitive search
154
+ results = parser.css('p:lexbor-contains("awesome" i)')
155
+ # Case-sensitive search
156
+ results = parser.css('p:lexbor-contains("AwesOme")')
157
+ assert len(results) == 1
158
+ assert results[0].text() == "lexbor is AwesOme"
159
+ ```
160
+
161
+ * [Detailed overview](https://github.com/rushter/selectolax/blob/master/examples/walkthrough.ipynb)
162
+
163
+ ### Available backends
164
+
165
+ Selectolax supports two backends: `Modest` and `Lexbor`. By default, all examples use the `Lexbor` backend.
166
+ Most of the features between backends are almost identical, but there are some differences.
167
+
168
+ As of 2024, the preferred backend is `Lexbor`. The `Modest` backend is still available for compatibility reasons
169
+ and the underlying C library that selectolax uses is not maintained anymore.
170
+
171
+ To use `lexbor`, just import the parser and use it in the similar way to the `HTMLParser`.
172
+
173
+ ```python
174
+ In [1]: from selectolax.lexbor import LexborHTMLParser
175
+
176
+ In [2]: html = """
177
+ ...: <title>Hi there</title>
178
+ ...: <div id="updated">2021-08-15</div>
179
+ ...: """
180
+
181
+ In [3]: parser = LexborHTMLParser(html)
182
+ In [4]: parser.root.css_first("#updated").text()
183
+ Out[4]: '2021-08-15'
184
+ ```
185
+
186
+ ## Simple Benchmark
187
+
188
+ * Extract title, links, scripts and a meta tag from main pages of top 754 domains. See `examples/benchmark.py` for more information.
189
+
190
+ | Package | Time |
191
+ |-------------------------------|-----------|
192
+ | Beautiful Soup (html.parser) | 61.02 sec.|
193
+ | lxml / Beautiful Soup (lxml) | 9.09 sec. |
194
+ | html5_parser | 16.10 sec.|
195
+ | selectolax (Modest) | 2.94 sec. |
196
+ | selectolax (Lexbor) | 2.39 sec. |
197
+
198
+ ## Links
199
+
200
+ * [selectolax API reference and examples](https://selectolax.readthedocs.io/en/latest/index.html)
201
+ * [Video introduction to web scraping using selectolax](https://youtu.be/HpRsfpPuUzE)
202
+ * [How to Scrape 7k Products with Python using selectolax and httpx](https://www.youtube.com/watch?v=XpGvq755J2U)
203
+ * [Modest introduction](https://lexborisov.github.io/Modest/)
204
+ * [Modest benchmark](https://lexborisov.github.io/benchmark-html-parsers/)
205
+ * [Python benchmark](https://rushter.com/blog/python-fast-html-parser/)
206
+ * [Another Python benchmark](https://www.peterbe.com/plog/selectolax-or-pyquery)
207
+ * [Universal interface to lxml and selectolax](https://github.com/lorien/domselect)
208
+
209
+ ## License
210
+
211
+ * Modest engine — [LGPL2.1](https://github.com/lexborisov/Modest/blob/master/LICENSE)
212
+ * lexbor engine — [Apache-2.0 license](https://github.com/lexbor/lexbor?tab=Apache-2.0-1-ov-file#readme)
213
+ * selectolax - [MIT](https://github.com/rushter/selectolax/blob/master/LICENSE)
214
+
215
+
216
+ ## Contributors
217
+
218
+ Thanks to all the contributors of selectolax!
219
+
220
+ <a href="https://github.com/rushter/selectolax/graphs/contributors">
221
+ <img src="https://contrib.rocks/image?repo=rushter/selectolax" />
222
+ </a>
@@ -0,0 +1,27 @@
1
+ selectolax/lexbor.pyi,sha256=ALFNgAsS60DN_Eh4y1EJQB7TLmxaa-Q18MQ_Y134lxg,36763
2
+ selectolax/parser.pyx,sha256=sBq2_HR83Ek8yqnFBYrG2xBBCM4S6Jiiie_xq5O_twE,13684
3
+ selectolax/lexbor.cpython-310-darwin.so,sha256=zXA4dcDNXkD4WlgHXEAvW5IiTsSHYjeg_9fB5enCiS0,3560000
4
+ selectolax/__init__.py,sha256=x6GncNA8EpAckyboq-AmhTOlZZOUD7UDXq5JWMbdme4,148
5
+ selectolax/parser.cpython-310-darwin.so,sha256=N0jRpBJ3LZ83Vte4Lmn2k-Amtesi3vORFZU3V-mELj8,2774528
6
+ selectolax/lexbor.pxd,sha256=5vgq_RgBhemsjimZVTi9PvSfkuymB3Nib-I7CKDxfS8,22751
7
+ selectolax/lexbor.pyx,sha256=hoHzlzDKkIk7KUvgro6YysP4N58gr-3qP7O1JXcrivs,21050
8
+ selectolax/parser.pyi,sha256=qi9AHy_DWalANSOVTN6gbtbf-YJZCfE7i12aWJbrUp8,24929
9
+ selectolax/utils.pxi,sha256=_g-ZLprPgbqv7BLs-WEe8IhbDd_QTcfirz_NEyR1Yww,3506
10
+ selectolax/lexbor.c,sha256=iQUCHWpDkL3ybRtXPJ9kLblo9TsEOhAfDBQeo-RgBuI,2414163
11
+ selectolax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ selectolax/parser.c,sha256=oLAQzCSitN-sH1YFi9i0r50LMhHZsyyI8CuVd2ptXvg,2116069
13
+ selectolax/base.pxi,sha256=eiPKlY9gG3l49qJoRQVLl1Ljza6z1k0A-met6sDPcqE,89
14
+ selectolax/parser.pxd,sha256=BQSlDGibVfqFDhfqX6l5sBnfkHEETxlj-eSpGWERKEs,24618
15
+ selectolax/modest/selection.pxi,sha256=m4GDpl0aI7lSWHFeBBheroUKDrZgJcc6uVubtzrXL1M,6508
16
+ selectolax/modest/util.pxi,sha256=di9cLmAyuGFXmiuptZ7Fz1SgkCf7hmiZLnpKCKEKsUc,552
17
+ selectolax/modest/node.pxi,sha256=l0aQf2Ojpzxh-L-0KxLetG7uGgGhkV7Cqgfy8O_5ch4,33786
18
+ selectolax/lexbor/selection.pxi,sha256=0zkJDakyOQtkBSUPhpfC_a_bxdbgU1qsE6_6sPTT2Ow,8036
19
+ selectolax/lexbor/util.pxi,sha256=hqMQU1O_5O82ThjUzk8NxQPl-Kg29DDGFFpC46LcejI,564
20
+ selectolax/lexbor/node.pxi,sha256=YqFgg-OGBgGuImKrHxapTGYiyIpxjpmGvi9vyEV3ee0,38762
21
+ selectolax/lexbor/node_remove.pxi,sha256=iqJ2PPNvQmK2dq8kJLXiZawoGf1Az3MpbrlQI6k4jDM,760
22
+ selectolax/lexbor/attrs.pxi,sha256=eH90zJYHicffTzC7peIitHkOqyIw3xzomhJHxJv9hP8,3858
23
+ selectolax-0.4.4.dist-info/RECORD,,
24
+ selectolax-0.4.4.dist-info/WHEEL,sha256=aNQV8Up4rZuRmZ4dQF1gRf2_E64p7eyxNGuFzXK-F6k,137
25
+ selectolax-0.4.4.dist-info/top_level.txt,sha256=e5MuEM2PrQzoDlWetkFli9uXSlxa_ktW5jJEihhaI1c,11
26
+ selectolax-0.4.4.dist-info/METADATA,sha256=Ef_YMdqD91XWYpFxVkHtgcagOgJwGRFrIDXY3wC0oXo,8192
27
+ selectolax-0.4.4.dist-info/licenses/LICENSE,sha256=MYCcM-Cv_rC2-lQiwDumin0E-rMXAhK-qIGGA29434Y,1077
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-macosx_10_9_x86_64
5
+ Generator: delocate 0.13.0
6
+
@@ -0,0 +1,10 @@
1
+
2
+ MIT License
3
+
4
+ Copyright (c) 2018-2025, Artem Golubin
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ selectolax