A library to expand Short URL with all possible redirections
Project description
pyurlextract
pyurlextract is a Python library that extracts all possible links and redirections from any shortened URL. It helps in expanding short links to reveal their full URLs and potential redirections.
Links
PyPI: https://pypi.org/project/pyurlextract/
Installation
Install the library using pip:
pip install pyurlextract
Usage
Here's how you can use pyurlextract to extract links from a shortened URL:
from pyurlextract import extract_shorturl
short_url = "link" # Replace with the actual short URL
full_link, all_links = extract_shorturl(short_url)
if full_link is None:
print("Failed to expand the URL")
print("Details:", all_links)
else:
print("Original URL:", short_url)
print("Full Link:", full_link)
print("All Possible Redirections:", all_links)
print(extract_shorturl(short_url))
Parameters
short_url(str): The shortened URL that needs to be expanded.
Returns
full_link(str | None): The fully expanded URL orNoneif extraction fails.all_links(list): A list of all possible redirections found.
Example Output
Original URL: https://bit.ly/example
Full Link: https://example.com/page
All Possible Redirections: ['https://example.com/page', 'https://redirect.example.com']
Features
- Expands shortened URLs from various services.
- Extracts all possible redirections from a given URL.
- Easy-to-use Python interface.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License.
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 pyurlextract-1.1.tar.gz.
File metadata
- Download URL: pyurlextract-1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c55b60c1616e1dbcac7caf11f5aaff452f2c384c7b5349a35864c7004a653a9a
|
|
| MD5 |
a194da9ea277451843ef18a6f916d68c
|
|
| BLAKE2b-256 |
0bced52a9734bde09ec20ad06e04f6004a7d970b3ac052e5615dd8c38a76c410
|
File details
Details for the file pyurlextract-1.1-py3-none-any.whl.
File metadata
- Download URL: pyurlextract-1.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38d99f28ba31b49bebde9d78467ff1b1b27b9f8a99af4380dfa0123f2289d277
|
|
| MD5 |
f7ccb04fce57ac9d3dff97aff556445e
|
|
| BLAKE2b-256 |
38e3929881afdf3410d0c6f0052c84a49ad8237df9e830c3092bdd87bd41d972
|