[SOLVED] Link shortener for Termux?

Hi
I’ve found a YouTube video that shows ShortUrl running in Termux.
Here it is…

https://www.youtube.com/watch?v=6yBrFWZovXc

So far I’ve been able to run ShortUrl from command-line with my Linux Desktop PC.

Before I go any further to try it with Termux…

Are there already any link shortener packages that are available for Termux?

So that I can install it easily with command…
pkg install [package name]

This is ShortUrl running with Linux…


   / ____| |              | |   | |  | |  __ \| |     
  | (___ | |__   ___  _ __| |_  | |  | | |__) | |     
   \___ \|  _ \ / _ \|  __| __| | |  | |  _  /| |     
   ____) | | | | (_) | |  | |_  | |__| | | \ \| |____ 
  |_____/|_| |_|\___/|_|   \__|  \____/|_|  \_\______|

        Created By HTR-TECH ( Tahmid Rayat )

    Github : htr-tech | Instagram : @tahmid.rayat

 [01] Short Url
 [02] More From Us
 [03] Exit

 [~] Select an option: 1


 [~] Input The Url : https://forum.f-droid.org/

 [~] Shorting Url...

 [~] Done !!

 [~] Shortned Url : https://tinyurl.com/y2g3z58g
1 Like

Hello again.

Inside that ShortUrl git is a file named “url”.
It’s a bash script.
So I’ve copied it into Termux Home and made it executable… chmod +x url
No need to install it with a package manager.
Now I can run it like this…
./url
Then select options 1 or 2 or 3.

Here is ShortUrl running with Termux…
> _____ _ _ _ _ _____ _

       / ____| |              | |   | |  | |  __ \| |
      | (___ | |__   ___  _ __| |_  | |  | | |__) | |
       \___ \|  _ \ / _ \|  __| __| | |  | |  _  /| |
       ____) | | | | (_) | |  | |_  | |__| | | \ \| |____
      |_____/|_| |_|\___/|_|   \__|  \____/|_|  \_\______|

            Created By HTR-TECH ( Tahmid Rayat )

        Github : htr-tech | Instagram : @tahmid.rayat

     [01] Short Url
     [02] More From Us
     [03] Exit

     [~] Select an option: 1


     [~] Input The Url : https://chromium.woolyss.com/

     [~] Shorting Url...

     [~] Done !!

     [~] Shortned Url : https://tinyurl.com/yy45pp6n

Hello again
I made a lean and mean version of the url script.
Now it runs like this…

./url [URL]

Example…

./url https://forum.f-droid.org/

I suppose it would be possible to use different shorteners instead of tinyurl.
For example bitly.com and others.

Line 15 in the script is…
shorturl=$(curl -s http://tinyurl.com/api-create.php?url=$1)

So it would need different api addresses instead of tinyurl.

This is the modified script…

#!/bin/bash
#
#
# ShortUrl
# January 30 2021.
#
# Usage:-
# ./url <URL>
#
## Inspired by Tahmid Rayat.
## https://github.com/htr-tech/shorturl
#
#
printf " \e[0m\e[1;91m[\e[0m\e[1;97m~\e[0m\e[1;91m]\e[0m\e[1;93m Shorting Url...\e[0m\n"
shorturl=$(curl -s http://tinyurl.com/api-create.php?url=$1)
sleep 2
printf "\e[0m\n"
printf " \e[0m\e[1;91m[\e[0m\e[1;97m~\e[0m\e[1;91m]\e[0m\e[1;93m Done !!\e[0m\n"
printf "\e[0m\n"
printf ' \e[0m\e[1;91m[\e[0m\e[1;97m~\e[0m\e[1;91m]\e[0m\e[1;92m Shortned Url :\e[0m\e[1;93m %s \n' $shorturl
printf "\e[0m\n"
sleep 2
printf "\e[0m\n"
printf "\e[0m\n"
exit 1
#
#
#

And here it is in action…

Welcome to Termux!

Community forum: https://termux.com/community
Gitter chat:     https://gitter.im/termux/termux
IRC channel:     #termux on freenode

Working with packages:

 * Search packages:   pkg search <query>
 * Install a package: pkg install <package>
 * Upgrade packages:  pkg upgrade

Subscribing to additional repositories:

 * Root:     pkg install root-repo
 * Unstable: pkg install unstable-repo
 * X11:      pkg install x11-repo

Report issues at https://termux.com/issues

The Google Play version of the Termux app no longer
receives updates. For more information, visit:
https://wiki.termux.com/wiki/Termux_Google_Play

~ $ ./url https://forum.f-droid.org/
 [~] Shorting Url...

 [~] Done !!

 [~] Shortned Url : https://tinyurl.com/y2g3z58g



~ $

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.