Read HTML data and convert it into python classes.
Project description
HTML-Reader
Read HTML data and convert it into python classes.
Installation
From PyPi:
pip install HTML-Reader
From Github Repo:
pip install git+https://github.com/Monkvy/HTML-Reader
Usage
Get elements by class, id, src, etc.
- Open a HTML-File or create a string with HTML code.
- Get HTML-Element by calling Element.Get() and insert a keyword.
Example HTML-File "example.html":
<div class="content">
<h1 class="title">Example title</h1>
<p>
Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, sed diam
</p>
</div>
Python Code:
import HTMLReader
with open("example.html", "r") as file:
raw_html = file.read()
title = HTMLReader.Element.Get(raw_html, "class=\"title\"")[0]
print(title.content)
Output:
Example title
Get elements by tag
- Open a HTML-File, created in the example above.
- Get HTML-Element by calling Element.GetWithTag() and insert a tag.
import HTMLReader
with open("example.html", "r") as file:
raw_html = file.read()
title = HTMLReader.Element.GetWithTag(raw_html, "p")[0]
print(title.content)
Output:
Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, sed diam
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
HTML-Reader-1.1.1.tar.gz
(4.5 kB
view details)
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 HTML-Reader-1.1.1.tar.gz.
File metadata
- Download URL: HTML-Reader-1.1.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6a65b11a4bb81f5f0ce8adb444d46391b7840d2b9a8c0174e8f013c4d9f9022
|
|
| MD5 |
f31e97d23bd151a644a594bb497d9274
|
|
| BLAKE2b-256 |
6eca852091613a8c270a1a9b98ac83ac615bc3c7d0577e77a1d26e000c3b6411
|
File details
Details for the file HTML_Reader-1.1.1-py3-none-any.whl.
File metadata
- Download URL: HTML_Reader-1.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0ff4750cd2a691055df3ce3b9e8535820a82364b4de2f4a87a0e6e076ff4c5f
|
|
| MD5 |
ec502d339a45621b45e0eb62d2cfc296
|
|
| BLAKE2b-256 |
9b9895b7c59a53b693b08cab60be16ef0b82f183a37642c7e5acca686c392512
|