TinyURL retriever

By Daveoh on Aug 21, 2006

What it does: Returns a TinyURL to the user/channel.
Usage: !tinyurl http://URL.com - Either you or someone else can say this in a channel and the tinyurl will be returned to the channel.
Also; /tinyurl http://URL.com will echo the tinyurl to the active window

;;TinyURL
on *:TEXT:!tinyurl &:#:{ if (%tinyspam) { halt }
  set -u3 %tinyspam 1
  set %tinyurlchan $chan
  set %tinyurl1 $2
  if ($sock(tinyurl)) { sockclose tinyurl }
  sockopen tinyurl tinyurl.com 80
}
on *:INPUT:#:{
  if (!tinyurl == $1 && $2 != $null && %tinyspam == $null) {
    set -u3 %tinyspam 1
    set %tinyurlchan $chan
    set %tinyurl1 $2
    if ($sock(tinyurl)) { sockclose tinyurl }
    sockopen tinyurl tinyurl.com 80
} }
alias tinyurl {
  set -u3 %tinyspam 1
  set %tinyurl1 $1
  if ($sock(tinyurl)) { sockclose tinyurl }
  sockopen tinyurl tinyurl.com 80
}
on *:sockopen:tinyurl:{
  sockwrite -n $sockname GET /create.php?url= $+ %tinyurl1 HTTP/1.0
  sockwrite -n $sockname Host: tinyurl.com
  sockwrite -n $sockname user-agent: Mozilla/??
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname $crlf
}
on 1:sockread:tinyurl:{
  :nextread
  if ($sockerr > 0) return
  sockread %temp
  if ($sockbr == 0) return

  if (<blockquote><b>* iswm %temp && $left($replace(%tinyurl1,&,&amp;),15) !isin %temp) {
    set %tinyurl2 $remove($gettok(%temp,2,60),b>)
    if (%tinyurlchan) { msg %tinyurlchan Shortened %tinyurl1 to %tinyurl2 }
    else { echo -a Shortened %tinyurl1 to %tinyurl2 }
    unset %tinyurl*
  }

  goto nextread
}

Comments

Sign in to comment.
Raicho Ichisada   -  Jun 22, 2010

its really works, nice

 Respond  
Ne0   -  Nov 19, 2006

never mind i found it lol

 Respond  
Ne0   -  Nov 19, 2006

Have you made a change to the script Daveoh as i couldnt see anything looking over it, i also get the problem of not getting a tinyurl result if the original address is too long.
The script has been modded slightly via help from forums and is not that useless to have it the way i liked.

 Respond  
Ne0   -  Oct 11, 2006

could this be adapted so that rather than having to trigger it with !tinyurl simply adding a url to the channel would automatically convert it to tinyurl?

 Respond  
Daveoh   -  Aug 23, 2006

Sorry, it works fine with me, I can\'t replicate that problem

 Respond  
aceman   -  Aug 22, 2006

Hi, I tried this script as it seems a good idea, but there\'s just one thing not quite right. If someone in a channel you\'re not active in uses the script, it doesn\'t give them the shortened URL, it just repeats the URL they wanted to shorten. Example:

!tinyurl http://www.youtube.com/watch?v=o1O7ZvDFP_8&NR [@aceman] Shortened http://www.youtube.com/watch?v=o1O7ZvDFP_8&NR to http://www.youtube.com/watch?v=o1O7ZvDFP_8&NR In the channel I\'m active in: \'Shortened to http://tinyurl.com/ez2a7\' It messages the shortened URL to me, but not the person that wanted it. It\'s a good script and quite handy to use, you just need to change how it announces the tinyurl to the person. :)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.