/* ** ** Created by: Rand (@DALnet) ** Script name: Tinyurl - v1.0 ** ** Description: ** ** This script allows you to take a long url, ** and create a short one via the use of tinyurl.com ** ** ** Useage: ** ** /tinyurl [-s] [url] ** ** * The -s switch is optional, uses /say, instead of /echo. ** ** * The url is also optional, if you do not specify one it ** will do one of the following, in this order: ** * Check the clipboard for a URL ** * Check to see if $url is filled (meaning your browser is open) ** */ alias tinyurl { turl $1 } alias turl { if ($1 == -s) { hadd -m tinyurl disp say | tokenize 32 $2- } else { hadd -m tinyurl disp echo -a Url: } if (!$1) { if ($regex($cb(1),/^http:\S+$/)) { tokenize 32 $gettok($cb(1),1,32) } elseif ($url) { tokenize 32 $url } else { echo -a Tinyurl: Error. $& You need to specify a url, or have one in your clipboard, $& or have your browser open to the page you want to use. } } if ($sock(tinyurl)) { sockclose tinyurl } sockopen tinyurl www.tinyurl.com 80 sockmark tinyurl $1 } on *:sockopen:tinyurl:{ var %% = sockwrite -n $sockname if ($sock($sockname).status != active) { echo -a *** Tinyurl: failed to connect to tinyurl.com hfree tinyurl | return } %% GET /create.php?url= $+ $sock($sockname).mark HTTP/1.0 %% Host: tinyurl.com %% User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) %% } on *:sockread:tinyurl:{ var %s | sockread %s if ($regex(%s,/
(.{7}tinyurl\.com.*?)<\/b>
\[.*?\]<\/small><\/blockquote>/Si)) { $hget(tinyurl,disp) $regml(1) } } on *:sockclose:tinyurl:{ hfree tinyurl }