Top

TinyURL retriever


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  6.5 (of 2 scores)
Date Added  Aug 21, 2006
Last Updated  Apr 02, 2007
Tags  socket  tinyurl  web 

Introduction

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

Grab the Code

;;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

  (6)  RSS
aceman
Comments: 1
 
mIRC Snippet:  TinyURL retriever
Posted on Aug 22, 2006 3:36 pm
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:
<someone> !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&amp;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. :)
Daveoh
Comments: 27
 
mIRC Snippet:  TinyURL retriever
Posted on Aug 23, 2006 7:07 pm
Sorry, it works fine with me, I can't replicate that problem
Ne0
Comments: 7
 
mIRC Snippet:  TinyURL retriever
Posted on Oct 11, 2006 5:50 am
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?
Daveoh
Comments: 27
 
mIRC Snippet:  TinyURL retriever
Posted on Nov 18, 2006 2:10 am
Forgetting about my previous (stupid) comment, everything should be fixed now
Previously if the URL was too long (or maybe contained an &) it didn't notice the URL in the page
Sorry for the 3 month delay aceman ;)
And Ne0 that is not the purpose of this script and would also be useless
Ne0
Comments: 7
 
mIRC Snippet:  TinyURL retriever
Posted on Nov 19, 2006 11:55 am
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.
Ne0
Comments: 7
 
mIRC Snippet:  TinyURL retriever
Posted on Nov 19, 2006 12:03 pm
never mind i found it lol

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom