js-vars-extractor
A lightweight Python library designed to extract JavaScript variables, objects, and configurations from <script> tags within HTML documents
Installation
Using uv:
uv add js_vars_extractor
Quick Start
from selectolax.lexbor import LexborHTMLParser
from js_vars_extractor import find_js_var
html = """
<html>
<head>
<script>
window.APP_CONFIG = {
env: "production",
apiUrl: "[https://api.example.com](https://api.example.com)",
features: ["auth", "payments"]
};
</script>
</head>
</html>
"""
parser = LexborHTMLParser(html)
config = find_js_var("window.APP_CONFIG", parser)
print(config)
# Output:
{
'env': 'production',
'apiUrl': '[https://api.example.com](https://api.example.com)',
'features': ['auth', 'payments']
}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file js_vars_extractor-0.1.7.tar.gz.
File metadata
- Download URL: js_vars_extractor-0.1.7.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80cc88311ee89090c0543c7512a8b618dc16d0ed5091f07903ca3f89f0272731
|
|
| MD5 |
2021eef4b781853f6611f5e6ee91f914
|
|
| BLAKE2b-256 |
fb31858e4d5b9117c726e8b96a7963e55e2e31b9b214e927b60fd06c57158589
|
File details
Details for the file js_vars_extractor-0.1.7-py3-none-any.whl.
File metadata
- Download URL: js_vars_extractor-0.1.7-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.8.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
971050575e7313eeb745f95a77b46c146b30dc4cb81c062ba1c3bfb72829b181
|
|
| MD5 |
bc237713ecc963fb53bf89c36b8696ed
|
|
| BLAKE2b-256 |
dfaeca6c25738fdbc8940010df00a94eafdc85f3f2b46d65e44bdb922ce1c50f
|