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
Hashes for get_html_from_safari-0.1.14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29e1d4f4d0ce66928027305b3a495ffaafb5d131a4c8fd4862641aabffe94756 |
|
MD5 | 8696093ee1272428bec2d98bf0eae9fe |
|
BLAKE2b-256 | 57d4e418aa8d0c89b8330a537d7483584ce486facfcb34ef7c3c7bef7a9438dd |
Hashes for get_html_from_safari-0.1.14-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84033640ee8fb28cfdf5ec817ac13fdf693243f8260b7f32a8d32146de148fd |
|
MD5 | 4462491c41538a3f784678c67e6cecf9 |
|
BLAKE2b-256 | 026a54908cf7aae80de1aaea2b0275469f32d463a7a3d3612ad03700dac7b09b |