This script offers a simple utility to automatically detect and shorten URLs within a text file using the tinyurl.com service. It's especially handy for markdown files or other textual content where you'd like to replace long, unwieldy URLs with shorter versions.
- URL Detection: Utilizes regex to automatically identify all URLs present in the designated input.md file.
- Automatic Shortening: Every detected URL is shortened via the tinyurl.com API.
- File Input/Output: Reads from input.md and writes the content with the shortened URLs to output.md.
-
π₯ Clone or download this repository.
-
π Fill the input.md file with your content, which includes the URLs you wish to shorten.
-
βΆοΈ Run the script:python your_script_name.py -
π€ Check the output.md file for the content with the now shortened URLs.
- Python 3.x
- requests library (to make the HTTP requests). To install the required library, use:
pip install requests