Script was requested by Luke on irc.geekshed.net
Simple URL shortener for your bot.
You must turn this on from the right click channel or status menu. Under bitly, click trigger on.
Syntax is !bitly http://link.name
There is a ! trigger to notice the user and a @ trigger to message the channel. The @ trigger requires halfops or higher to use.
There is also an alias that can be typed from the client the script is loaded into.
Syntax /echobitly http://link.name.here
Example output:
17:09:51 @bitly http://pastebin.com/m63db9ac2
17:09:54 <+RingKing Searching Bitly .......
17:09:54 <+RingKing Bitly » http://bit.ly/7S3RJ7
;Bitly Url Shortener by Ford_Lawnmower irc.mindforge.org #USA-Chat
menu Channel,Status {
.$iif($group(#Bitly) == On,$style(1)) Bitly Trigger
..$iif($group(#Bitly) == On,$style(2)) On: .enable #Bitly
..$iif($group(#Bitly) == Off,$style(2)) Off: .disable #Bitly
}
#Bitly off
On $*:Text:/^(!|@)Bitly.*/Si:#: {
if ($timer($+(Bitly,$network,$nick))) { return }
.timer $+ $+(Bitly,$network,$nick) 1 6 noop
var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
Bitly %method $2-
}
#Bitly end
alias EchoBitly { Bitly echo -a $1- }
alias -l Bitly {
$1-2 07Searching 04B06i07t09l03y........
var %sockname $+(Bitly,$network,$2,$ticks)
sockopen %sockname bit.ly 80
sockmark %sockname $1-2 $+(/?s=&keyword=&url=,$3-)
}
On *:sockopen:Bitly*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: bit.ly
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:Bitly*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %Bitly | sockread %Bitly
if ($regex(%bitly,/<input id="shortened-url" value="(.*)"/)) {
$gettok($sock($sockname).mark,1-2,32) 04B06i07t09l03y 04» $+(07,$regml(1),)
}
}
}
@GTAXL Here is is.gd
;is.gd url shortener by Ford_Lawnmower irc.abjects.net #mIRC
alias -l is.gd.logo return $+($chr(2),$chr(3),04,$chr(44),00,IS,$chr(15))
menu Channel,Status {
.$iif($group(#is.gd) == On,$style(1)) is.gd Trigger
..$iif($group(#is.gd) == On,$style(2)) On: .enable #is.gd
..$iif($group(#is.gd) == Off,$style(2)) Off: .disable #is.gd
}
#is.gd on
On $*:Text:/^(\+|-|!|@)gd*/Si:#: {
var %action $regml(1)
if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
if (%action == +) {
if ($istok(%is.gdChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the is.gd script }
else {
.enable #is.gd
Set %is.gdChanList $addtok(%is.gdChanList,$+($network,$chan),32)
.msg $chan $nick has activated the is.gd script for $chan .
}
}
else {
if (!$istok(%is.gdChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the is.gd script }
else {
Set %is.gdChanList $remtok(%is.gdChanList,$+($network,$chan),1,32)
.msg $chan $nick has deactivated the is.gd script for $chan .
}
}
}
elseif (!$timer($+(is.gd,$network,$nick))) && ($istok(%is.gdChanList,$+($network,$chan),32)) {
.timer $+ $+(is.gd,$network,$nick) 1 6 noop
var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
Getis.gd %method $2-
}
}
#is.gd end
alias is.gd { Getis.gd echo -a $1- }
alias -l Getis.gd {
var %sockname $+(is.gd,$network,$2,$ticks)
sockopen %sockname is.gd 80
sockmark %sockname $1-2 $+(/create.php?url=,$urlencode($3))
}
On *:sockopen:is.gd*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:is.gd*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %is.gd | sockread %is.gd
if ($regex(comment,%is.gd,/createformlabel">(.*?)</i) && $regex(%is.gd,/id="short_url"\svalue="(.*?)"/i)) {
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo $regml(comment,1)
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo $+($chr(31),$regml(1))
}
elseif ($regex(comment,%is.gd,/createformlabel">(.*?)</i)) {
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo $regml(comment,1)
$gettok($sock($sockname).mark,1-2,32) $is.gd.logo *invalid url*
}
}
}
alias -l urlencode { return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2)) }
Just tried out the "original" script you posted plus the onces you posted here in comments.
Doesn't seem to be working... besides shadyurl which made Me laugh :P
Awesome work haha :P not quite what I'm looking for... but BiG UPs...
sure it will come in handy... :D:D
Anyways... I'm looking for something like tinyurl that will shorten the links to something not quite as shady :P
Sure Luke. Here it is:
;lshort Url Shortener by Ford_Lawnmower irc.mindforge.org #USA-Chat
menu Channel,Status {
.$iif($group(#lshort) == On,$style(1)) lshort Trigger
..$iif($group(#lshort) == On,$style(2)) On: .enable #lshort
..$iif($group(#lshort) == Off,$style(2)) Off: .disable #lshort
}
#lshort on
On $*:Text:/^(!|@)lshort.*/Si:#: {
if ($timer($+(lshort,$network,$nick))) { return }
.timer $+ $+(lshort,$network,$nick) 1 6 noop
var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
Getlshort %method $2-
}
#lshort end
alias lshort { Getlshort echo -a $1- }
alias -l Getlshort {
$1-2 07Searching ........
var %sockname $+(lshort,$network,$2,$ticks)
sockopen %sockname lshort.co.cc 80
sockmark %sockname $1-2 $+(/index.php?url=,$3,&alias=,$4)
}
On *:sockopen:lshort*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: lshort.co.cc
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:lshort*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %lshort | sockread %lshort
if ($regex(%lshort,/<p><strong>([^<]*)<\/strong><br\s\/>/)) {
$gettok($sock($sockname).mark,1-2,32) 04l06s07h09o03r06t 04» $+(07,$regml(1),)
}
}
}
The alias function also works on this. Example:
!lshort google.com mazogoogle
Will return -->> http://lshort.co.cc/mazogoogle
O.o That site is a little warped ;/
Here it is though :)
;shadyurl Url Shortener by Ford_Lawnmower irc.mindforge.org #USA-Chat
menu Channel,Status {
.$iif($group(#shadyurl) == On,$style(1)) shadyurl Trigger
..$iif($group(#shadyurl) == On,$style(2)) On: .enable #shadyurl
..$iif($group(#shadyurl) == Off,$style(2)) Off: .disable #shadyurl
}
#shadyurl on
On $*:Text:/^(!|@)shadyurl.*/Si:#: {
if ($timer($+(shadyurl,$network,$nick))) { return }
.timer $+ $+(shadyurl,$network,$nick) 1 6 noop
var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
Getshadyurl %method $2-
}
#shadyurl end
alias shadyurl { Getshadyurl echo -a $1- }
alias -l Getshadyurl {
$1-2 07Searching ........
var %sockname $+(shadyurl,$network,$2,$ticks)
sockopen %sockname www.shadyurl.com 80
sockmark %sockname $1-2 $+(/create.php?myUrl=,$3-)
}
On *:sockopen:shadyurl*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: www.shadyurl.com
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:shadyurl*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %shadyurl | sockread %shadyurl
if ($regex(%shadyurl,/<p>is now<\/p> <a href='([^<]*)'>/)) {
$gettok($sock($sockname).mark,1-2,32) 04S06H07a09d03y 04» $+(07,$regml(1),)
}
}
}
works perfecly.. 10/10!
if u could make an url looks more suspicious and frightening from http://www.shadyurl.com/
it will be much more fun :D just a thought :P
For example this is google: http://z.pe/1iF
And this is hawkee: http://z.pe/Fo1
Pretty short eh?
Yea, that's a good point sunslayer. It's weird , but that site will produce a link for anything you send it. I tried this -->> http://bit.ly/?s=&keyword=&url=gobblediegook
And the site spit out this -->> http://bit.ly/6cx8vo
This site will produce a valid link if you send it yahoo.com, www.yahoo.com, http://www.yahoo.com or http://yahoo.com
So, unless I wanted to write a routine to check the validity of a link before I run the bitly routine, there is not much I can check for. I suppose I could check for at least one .(dot), as the list of valid extensions is no longer limited to .com,.net,.edu, etc.
.ly , I sure never heard of that one.