Markup Parser
Extract JS variables content from HTML markup
ENG
Installation
pip install markup-parser
Usage
Parse variable from html text:
Test content
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
</body>
<script>
let test_variable = 'You found me';
</script>
</html>
import requests
from markup_parser import var_from_html
# Fetch html content by get request
html_text = requests.get('http://test.html').text
var_from_html(html_text, 'test_variable')
# Parse from file
var_from_html(open('test.html').read(), 'test_variable')
# >>> You found me
Parse variable from url:
* This variant not recommended if you need to specify custom headers, this feature may be added in future release
Test content
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
</body>
<script>
let test_variable = 'You found me again!';
</script>
</html>
from markup_parser import var_from_url
var_from_url('http://test.page', 'test_variable')
# >>> You found me again!
RU
Установка
pip markup-parser
Примеры использования
Получить значение переменной из html разметки:
Пример html страницы
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
</body>
<script>
let test_variable = 'You found me';
</script>
</html>
import requests
from markup_parser import var_from_html
# Получить html разметку с помощью get запроса
html_text = requests.get('http://test.html').text
var_from_html(html_text, 'test_variable')
# Прочитать из файла
var_from_html(open('test.html').read(), 'test_variable')
# >>> You found me
Получить значение переменной по ссылке:
* На данный момент этот вариант не рекомендуется если вам необходимы специфичные заголовки, эта функция может появтися в будущих релизах
Пример html страницы
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
</head>
<body>
</body>
<script>
let test_variable = 'You found me again!';
</script>
</html>
from markup_parser import var_from_url
var_from_url('http://test.page', 'test_variable')
# >>> You found me again!
Metadata
Release files for markup-parser 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| markup_parser-0.1.3.tar.gz | 6.2 kB | Without provenance | Details for markup_parser-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| markup_parser-0.1.3-cp39-cp39-macosx_12_0_arm64.whl | CPython 3.9 | CPython 3.9 | macOS 12.0+ ARM64 | Details for markup_parser-0.1.3-cp39-cp39-macosx_12_0_arm64.whl |
Total release size: 7.5 MB
Release files / markup_parser-0.1.3.tar.gz
| Download URL | markup_parser-0.1.3.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3b3b193fc6b63952bcece930fb9f9b4a414773d8cc4f458f97a13582fba677c
|
|
BLAKE2b-256 checksum How to use checksums |
b64be66b2d6efc8127ae6ab7c9d17b7916e5f5149ce5ae0b130c39848debdda2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.18
|
Release files / markup_parser-0.1.3-cp39-cp39-macosx_12_0_arm64.whl
| Download URL | markup_parser-0.1.3-cp39-cp39-macosx_12_0_arm64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.9 macOS 12.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
aaa9a841861788b9251a1cd602c6008038a4d81d608c03dfe606c10300d34b9f
|
|
BLAKE2b-256 checksum How to use checksums |
c0c2b1c2c971737dc5aa472f929c94cbcfcb92eed625126418d54df8f10d7f5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.18
|
Security for markup-parser 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.