bs4 to pd.DataFrame
Tested against Windows / Python 3.11 / Anaconda
pip install bs42frame
Parse HTML content and extract information using BeautifulSoup.
This function takes HTML content as input, parses it using BeautifulSoup, and extracts
information about the HTML structure, tag attributes, tag text, and the BeautifulSoup
object for each element found in the HTML.
Args:
html (str, bytes, or file path): The HTML content to be parsed. It can be provided as
a string, bytes, or a file path. If a file path is provided, the function will
attempt to read the file.
Returns:
pandas.DataFrame: A DataFrame containing the extracted information from the HTML.
The DataFrame columns include 'aa_tag' (HTML tag name), 'aa_attrs' (list of tag
attributes), 'aa_text' (text content of the tag), 'aa_soup' (BeautifulSoup object
for the tag), 'aa_old_index' (original index of the tag), 'aa_key' (attribute
key), and 'aa_value' (attribute value).
Example:
from bs42frame import parse_html
df = parse_html(
html=r"C:\Users\hansc\Downloads\Your Repositories.mhtml"
)
# aa_tag aa_text aa_soup aa_old_index aa_key aa_value
# 1000 span Import repository [\r\n Import repository\r\n\r\n] 274 ActionListItem-label class
# 1001 li [] 275 presentation role
# 1002 li [] 275 true aria-hidden
# 1003 li [] 275 true data-view-component
# 1004 li [] 275 ActionList-sectionDivider class
Metadata
Release files for bs42frame 0.10
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 |
|---|---|---|---|---|
| bs42frame-0.10.tar.gz | 40.8 kB | Without provenance | Details for bs42frame-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bs42frame-0.10-py3-none-any.whl | Python 3 | none | any | Details for bs42frame-0.10-py3-none-any.whl |
Total release size: 82.7 kB
Release files / bs42frame-0.10.tar.gz
| Download URL | bs42frame-0.10.tar.gz |
|---|---|
| Size | 40.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd7e4c0fc2ba629c9c469b91a493804d2725f5f2551ed5aa590c5355863e1b15
|
|
BLAKE2b-256 checksum How to use checksums |
c1c12df87bb9a9239f70f9903d7b869b87dc0cf8e3f69e169f226194cd61b19d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / bs42frame-0.10-py3-none-any.whl
| Download URL | bs42frame-0.10-py3-none-any.whl |
|---|---|
| Size | 41.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c4234c1825976ac585ade207c760d4ceaf9a754204eae40c804aa9e6fe6311d
|
|
BLAKE2b-256 checksum How to use checksums |
15fbdf54789707ec5e59a5dac17d5e45e5347ed016ab76ba3282b22e93adfbcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for bs42frame 0.10
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.