Skip to main content

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 or None if 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.

Release files for pyurlextract 1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyurlextract 1.1
File Size Uploaded
pyurlextract-1.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyurlextract 1.1
File Interpreter ABI Platform
pyurlextract-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / pyurlextract-1.1.tar.gz

Download URL pyurlextract-1.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c55b60c1616e1dbcac7caf11f5aaff452f2c384c7b5349a35864c7004a653a9a
BLAKE2b-256 checksum
How to use checksums
0bced52a9734bde09ec20ad06e04f6004a7d970b3ac052e5615dd8c38a76c410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.5

Release files / pyurlextract-1.1-py3-none-any.whl

Download URL pyurlextract-1.1-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38d99f28ba31b49bebde9d78467ff1b1b27b9f8a99af4380dfa0123f2289d277
BLAKE2b-256 checksum
How to use checksums
38e3929881afdf3410d0c6f0052c84a49ad8237df9e830c3092bdd87bd41d972
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page