Skip to main content

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 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.

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyurlextract-1.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyurlextract-1.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

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

Hashes for pyurlextract-1.1.tar.gz
Algorithm Hash digest
SHA256 c55b60c1616e1dbcac7caf11f5aaff452f2c384c7b5349a35864c7004a653a9a
MD5 a194da9ea277451843ef18a6f916d68c
BLAKE2b-256 0bced52a9734bde09ec20ad06e04f6004a7d970b3ac052e5615dd8c38a76c410

See more details on using hashes here.

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

Hashes for pyurlextract-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38d99f28ba31b49bebde9d78467ff1b1b27b9f8a99af4380dfa0123f2289d277
MD5 f7ccb04fce57ac9d3dff97aff556445e
BLAKE2b-256 38e3929881afdf3410d0c6f0052c84a49ad8237df9e830c3092bdd87bd41d972

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page