Unix shell script to shorten URLs with tny.im URL shortener. wget must be installed for this to work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -t 0 ]; then | |
if [ -z "$1" ]; then | |
echo "usage: tny long_url [custom_keyword]" | |
echo "" | |
echo "Shorten URLs with tny.im URL shortener" | |
echo "This script expects a long URL to shorten either as an argument or passed through STDIN." | |
echo "When using arguments, an optional second argument can be provided to customize the later part of the short URL (keyword)." | |
exit 1 | |
fi | |
url=$(python -c "import urllib.parse; print(urllib.parse.quote_plus('$1'))"); | |
else | |
while read -r line ; do | |
url=$line | |
done | |
fi | |
echo `wget -q -O - http://tny.im/yourls-api.php?action=shorturl\&format=simple\&url=$url\&keyword=$2` |
Hey. What do you mean exactly with "it doesn't work"?
Sorry. I forgot to tell you that it is working now...
The issue can be closed...
…On Mon, 20 Feb 2023 at 09:54, Stefan Heinemann ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hey. What do you mean exactly with "it doesn't work"?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/49e133c0a2a66d567bc0#gistcomment-4477041> or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKLPRKJIUPJMLKC22Z45PQDWYNSQDBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVAZTANBQGE2TAONHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi.
I was using this code, but seems it is not working anymore...
Does it still work?
I've tried with this url
==> https://yt.funami.tech/watch?v=uJvCVw1yONQ&listen=false
Thx