Skip to main content

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

js_vars_extractor-0.1.7.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

js_vars_extractor-0.1.7-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

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

Hashes for js_vars_extractor-0.1.7.tar.gz
Algorithm Hash digest
SHA256 80cc88311ee89090c0543c7512a8b618dc16d0ed5091f07903ca3f89f0272731
MD5 2021eef4b781853f6611f5e6ee91f914
BLAKE2b-256 fb31858e4d5b9117c726e8b96a7963e55e2e31b9b214e927b60fd06c57158589

See more details on using hashes here.

File details

Details for the file js_vars_extractor-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for js_vars_extractor-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 971050575e7313eeb745f95a77b46c146b30dc4cb81c062ba1c3bfb72829b181
MD5 bc237713ecc963fb53bf89c36b8696ed
BLAKE2b-256 dfaeca6c25738fdbc8940010df00a94eafdc85f3f2b46d65e44bdb922ce1c50f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 files

0.1.6

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page