fasthtmlparser-pure 0.1.0__tar.gz → 0.1.2__tar.gz
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.
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/LICENSE.md +18 -3
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/PKG-INFO +5 -2
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/README.md +3 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/__init__.py +1 -1
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_xpath.py +34 -2
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/PKG-INFO +5 -2
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/pyproject.toml +2 -2
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_api.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_api.pyi +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_attrs.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_chars.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_css.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_decode.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_links.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_parser.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_query.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_tables.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/_text.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure/py.typed +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/SOURCES.txt +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/dependency_links.txt +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/top_level.txt +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/setup.cfg +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/tests/test_api.py +0 -0
- {fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/tests/test_conformance.py +0 -0
|
@@ -2,8 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Copyright © 2026 z3l. All rights reserved.
|
|
4
4
|
|
|
5
|
-
This license applies to the z3l.FastHtmlParser library
|
|
6
|
-
|
|
5
|
+
This license applies to the z3l.FastHtmlParser library and to every port of it to another language
|
|
6
|
+
published by z3l, including:
|
|
7
|
+
|
|
8
|
+
- C#: the NuGet package z3l.FastHtmlParser (github.com/romanti3172/z3l.FastHtmlParser);
|
|
9
|
+
- Go: the module github.com/romanti3172/fasthtmlparser;
|
|
10
|
+
- Rust: the crate fasthtmlparser (github.com/romanti3172/fasthtmlparser-rs);
|
|
11
|
+
- Java: io.github.romanti3172:fasthtmlparser (github.com/romanti3172/fasthtmlparser-java);
|
|
12
|
+
- JavaScript / TypeScript: the npm package z3l-fasthtmlparser (github.com/romanti3172/fasthtmlparser-js);
|
|
13
|
+
- Python: the packages fasthtmlparser (github.com/romanti3172/fasthtmlparser-py) and
|
|
14
|
+
fasthtmlparser-pure (github.com/romanti3172/fasthtmlparser-pure);
|
|
15
|
+
- PHP: the Composer package z3l/fasthtmlparser (github.com/romanti3172/fasthtmlparser-php);
|
|
16
|
+
- Ruby: the gem fasthtmlparser (github.com/romanti3172/fasthtmlparser-rb);
|
|
17
|
+
- C: github.com/romanti3172/fasthtmlparser-c;
|
|
18
|
+
- C++: github.com/romanti3172/fasthtmlparser-cpp.
|
|
19
|
+
|
|
20
|
+
It covers their source code, binaries and the packages built from them on any package registry
|
|
21
|
+
(together, the "Software").
|
|
7
22
|
|
|
8
23
|
## 1. Definitions
|
|
9
24
|
|
|
@@ -38,7 +53,7 @@ more**, the Licensee must purchase a Commercial License.
|
|
|
38
53
|
- A Licensee that stops being a Small Licensee (its Annual Revenue or Headcount reaches the
|
|
39
54
|
threshold) while already using the Software must purchase the Commercial License within
|
|
40
55
|
30 days.
|
|
41
|
-
- To purchase: https://
|
|
56
|
+
- To purchase: https://fasthtmlparser.com/#pricing, or contact **romanti3172@gmail.com** for an invoice.
|
|
42
57
|
|
|
43
58
|
The Commercial License grants the same rights as section 2, without the revenue and headcount
|
|
44
59
|
limits.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fasthtmlparser-pure
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Fast HTML / XML parser for scraping with XPath 1.0 and CSS selectors, in pure Python. A port of z3l.FastHtmlParser.
|
|
5
5
|
Author: z3l
|
|
6
|
+
License-Expression: LicenseRef-z3l-FastHtmlParser
|
|
6
7
|
Project-URL: Homepage, https://github.com/romanti3172/fasthtmlparser-pure
|
|
7
8
|
Project-URL: Source, https://github.com/romanti3172/fasthtmlparser-pure
|
|
8
9
|
Project-URL: Issues, https://github.com/romanti3172/fasthtmlparser-pure/issues
|
|
9
10
|
Keywords: html,parser,xpath,css,selectors,scraping,web-scraping,pure-python
|
|
10
11
|
Classifier: Development Status :: 4 - Beta
|
|
11
12
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: Other/Proprietary License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
15
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
@@ -26,6 +26,9 @@ Dynamic: license-file
|
|
|
26
26
|
# fasthtmlparser-pure
|
|
27
27
|
|
|
28
28
|
[](https://github.com/romanti3172/fasthtmlparser-pure/actions/workflows/ci.yml)
|
|
29
|
+
[](https://pypi.org/project/fasthtmlparser-pure/)
|
|
30
|
+
|
|
31
|
+
**Website:** [fasthtmlparser.com](https://fasthtmlparser.com): try the parser on any page, documentation and every language.
|
|
29
32
|
|
|
30
33
|
A fast HTML / XML parser for scraping, with **XPath 1.0** and **CSS selectors**, in **pure Python**: a port of
|
|
31
34
|
[z3l.FastHtmlParser](https://github.com/romanti3172/z3l.FastHtmlParser) with no compiled code and no dependencies. It
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# fasthtmlparser-pure
|
|
2
2
|
|
|
3
3
|
[](https://github.com/romanti3172/fasthtmlparser-pure/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/fasthtmlparser-pure/)
|
|
5
|
+
|
|
6
|
+
**Website:** [fasthtmlparser.com](https://fasthtmlparser.com): try the parser on any page, documentation and every language.
|
|
4
7
|
|
|
5
8
|
A fast HTML / XML parser for scraping, with **XPath 1.0** and **CSS selectors**, in **pure Python**: a port of
|
|
6
9
|
[z3l.FastHtmlParser](https://github.com/romanti3172/z3l.FastHtmlParser) with no compiled code and no dependencies. It
|
|
@@ -43,6 +43,9 @@ E_ATTR_EXISTS = 9 # name: [@name]
|
|
|
43
43
|
E_PATH = 10 # start (expr or None), absolute, steps; attr: a bare @name
|
|
44
44
|
E_FILTER = 11 # primary, preds
|
|
45
45
|
E_FUNCTION = 12 # fn, args
|
|
46
|
+
# fn, l (prefix), name, r (suffix), value (needle): contains/starts-with/ends-with(concat(l, @name, r), value),
|
|
47
|
+
# tested on the attribute in place (prefix and suffix may be empty)
|
|
48
|
+
E_ATTR_TEST = 13
|
|
46
49
|
|
|
47
50
|
OP_EQ = 0
|
|
48
51
|
OP_NEQ = 1
|
|
@@ -630,7 +633,24 @@ class _Compiler:
|
|
|
630
633
|
if fn in ("count", "sum", "name", "local-name") and args and args[0].type != TYPE_NODE_SET:
|
|
631
634
|
self.fail_at(f"{fn}() needs a node-set argument", t.p)
|
|
632
635
|
pos = fn == "position" or fn == "last" or any(a.pos for a in args)
|
|
633
|
-
return Expr(E_FUNCTION, info[2], pos, fn=fn, args=args)
|
|
636
|
+
return self.make_attribute_test(fn, args) or Expr(E_FUNCTION, info[2], pos, fn=fn, args=args)
|
|
637
|
+
|
|
638
|
+
def make_attribute_test(self, fn, args):
|
|
639
|
+
"""contains(@a, 'x'), starts-with(...), ends-with(...), also with the attribute wrapped in literals
|
|
640
|
+
(contains(concat(' ', @class, ' '), ' x '), the usual class test), are evaluated on the attribute in place,
|
|
641
|
+
without a node-set for every element. None: a plain function call."""
|
|
642
|
+
if fn not in ("contains", "starts-with", "ends-with") or args[1].op != E_LITERAL:
|
|
643
|
+
return None
|
|
644
|
+
arg = args[0]
|
|
645
|
+
name = self.attribute_name(arg)
|
|
646
|
+
if name is not None:
|
|
647
|
+
return Expr(E_ATTR_TEST, TYPE_BOOLEAN, False, fn=fn, l="", name=name, r="", value=args[1].value)
|
|
648
|
+
if arg.op == E_FUNCTION and arg.fn == "concat" and len(arg.args) == 3 and arg.args[0].op == E_LITERAL and arg.args[2].op == E_LITERAL:
|
|
649
|
+
name = self.attribute_name(arg.args[1])
|
|
650
|
+
if name is not None:
|
|
651
|
+
return Expr(E_ATTR_TEST, TYPE_BOOLEAN, False, fn=fn, l=arg.args[0].value, name=name,
|
|
652
|
+
r=arg.args[2].value, value=args[1].value)
|
|
653
|
+
return None
|
|
634
654
|
|
|
635
655
|
|
|
636
656
|
def _ascii_lower(s):
|
|
@@ -1101,6 +1121,18 @@ class Evaluator:
|
|
|
1101
1121
|
return raw is not None and at.attr_equals(raw, e.value) != e.negate
|
|
1102
1122
|
if op == E_ATTR_EXISTS:
|
|
1103
1123
|
return self.attribute_of(node, e.name) is not None
|
|
1124
|
+
if op == E_ATTR_TEST:
|
|
1125
|
+
# a missing attribute is an empty node-set, whose string-value is ""
|
|
1126
|
+
raw = self.attribute_of(node, e.name) or ""
|
|
1127
|
+
if dec.needs_decoding(raw):
|
|
1128
|
+
raw = dec.decode(raw, True)
|
|
1129
|
+
value = e.l + raw + e.r if e.l or e.r else raw
|
|
1130
|
+
fn = e.fn
|
|
1131
|
+
if fn == "contains":
|
|
1132
|
+
return e.value in value
|
|
1133
|
+
if fn == "starts-with":
|
|
1134
|
+
return value.startswith(e.value)
|
|
1135
|
+
return value.endswith(e.value)
|
|
1104
1136
|
return _to_boolean(self.eval_expr(e, node, position, size))
|
|
1105
1137
|
|
|
1106
1138
|
def eval_predicate(self, e, node, position, size):
|
|
@@ -1116,7 +1148,7 @@ class Evaluator:
|
|
|
1116
1148
|
op = e.op
|
|
1117
1149
|
if op == E_LITERAL or op == E_NUMBER:
|
|
1118
1150
|
return e.value
|
|
1119
|
-
if op in (E_AND, E_OR, E_COMPARE, E_ATTR_EQUALS, E_ATTR_EXISTS):
|
|
1151
|
+
if op in (E_AND, E_OR, E_COMPARE, E_ATTR_EQUALS, E_ATTR_EXISTS, E_ATTR_TEST):
|
|
1120
1152
|
return self.eval_bool(e, node, position, size)
|
|
1121
1153
|
if op == E_ARITH:
|
|
1122
1154
|
x = self.eval_number(e.l, node, position, size)
|
{fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/PKG-INFO
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fasthtmlparser-pure
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Fast HTML / XML parser for scraping with XPath 1.0 and CSS selectors, in pure Python. A port of z3l.FastHtmlParser.
|
|
5
5
|
Author: z3l
|
|
6
|
+
License-Expression: LicenseRef-z3l-FastHtmlParser
|
|
6
7
|
Project-URL: Homepage, https://github.com/romanti3172/fasthtmlparser-pure
|
|
7
8
|
Project-URL: Source, https://github.com/romanti3172/fasthtmlparser-pure
|
|
8
9
|
Project-URL: Issues, https://github.com/romanti3172/fasthtmlparser-pure/issues
|
|
9
10
|
Keywords: html,parser,xpath,css,selectors,scraping,web-scraping,pure-python
|
|
10
11
|
Classifier: Development Status :: 4 - Beta
|
|
11
12
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: Other/Proprietary License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
15
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
@@ -26,6 +26,9 @@ Dynamic: license-file
|
|
|
26
26
|
# fasthtmlparser-pure
|
|
27
27
|
|
|
28
28
|
[](https://github.com/romanti3172/fasthtmlparser-pure/actions/workflows/ci.yml)
|
|
29
|
+
[](https://pypi.org/project/fasthtmlparser-pure/)
|
|
30
|
+
|
|
31
|
+
**Website:** [fasthtmlparser.com](https://fasthtmlparser.com): try the parser on any page, documentation and every language.
|
|
29
32
|
|
|
30
33
|
A fast HTML / XML parser for scraping, with **XPath 1.0** and **CSS selectors**, in **pure Python**: a port of
|
|
31
34
|
[z3l.FastHtmlParser](https://github.com/romanti3172/z3l.FastHtmlParser) with no compiled code and no dependencies. It
|
|
@@ -4,9 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fasthtmlparser-pure"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "Fast HTML / XML parser for scraping with XPath 1.0 and CSS selectors, in pure Python. A port of z3l.FastHtmlParser."
|
|
9
9
|
readme = "README.md"
|
|
10
|
+
license = "LicenseRef-z3l-FastHtmlParser"
|
|
10
11
|
license-files = ["LICENSE.md"]
|
|
11
12
|
requires-python = ">=3.10"
|
|
12
13
|
authors = [{ name = "z3l" }]
|
|
@@ -14,7 +15,6 @@ keywords = ["html", "parser", "xpath", "css", "selectors", "scraping", "web-scra
|
|
|
14
15
|
classifiers = [
|
|
15
16
|
"Development Status :: 4 - Beta",
|
|
16
17
|
"Intended Audience :: Developers",
|
|
17
|
-
"License :: Other/Proprietary License",
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
19
19
|
"Programming Language :: Python :: 3 :: Only",
|
|
20
20
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fasthtmlparser_pure-0.1.0 → fasthtmlparser_pure-0.1.2}/fasthtmlparser_pure.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|