Get HTMl code from the Safari browser
Project description
Get HTML from Safari
Description
Gets HTML code from web pages open in the Safari browser.
Usage
The get_html_from_safari package provides a simple and convenient way to fetch the HTML source code of the currently active Safari browser tab on macOS. This package utilizes AppleScript to interact with the Safari browser and retrieve the HTML content.
Example Usage To use get_html_from_safari, follow these steps:
Install the package:
pip install get_html_from_safari
Import the package and fetch the HTML source code of the active Safari tab:
from get_html_from_safari import get_html html_content = get_html()
You can now process the retrieved HTML content as needed.
To fetch the HTML source code of a specific URL, pass the URL as an argument:
from get_html_from_safari import get_html url = "https://www.example.com" html_content = get_html(url)
This will open up a new browser window and fetch the HTML source code of the url specified.
Please note that this package is specifically designed for macOS and the Safari browser. It will not work with other operating systems or web browsers.
From the command line:
$ html-source-get <url>
Requirements
Python 3.6 or higher
macOS
Features
Contains an entry point html-source-get <url>.
If no url is supplied, it will get the HTML code from the current Safari tab. If a url is supplied, it will open a new tab and get the HTML code from that tab.
The HTML code is dumped directly to the terminal.
License
Free software: Apache Software License 2.0
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2023-04-05)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
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 get_html_from_safari-0.1.3.tar.gz.
File metadata
- Download URL: get_html_from_safari-0.1.3.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7040fc0decdfc30f4c8851f08dbb3b9d5ccc11a7a36bbcccea6d964474a74d28
|
|
| MD5 |
849989f38f4f579a7b49f5cf5198472e
|
|
| BLAKE2b-256 |
e5df8dc62a0277b1dd40d6374896f7d29df32db80b30e79c212cfb28aca80d99
|
File details
Details for the file get_html_from_safari-0.1.3-py2.py3-none-any.whl.
File metadata
- Download URL: get_html_from_safari-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b542ae51be742cee2ece75be852cfae81e3b832537d7dea3e443f8325fde012
|
|
| MD5 |
f4d4404c0eebd88a16a6b8b4b82e2cf9
|
|
| BLAKE2b-256 |
17200361d9686334e6a2bb363aa77c64b0d09160af03c2849df75edbea8a0e02
|