Automatic TinyURL Converter

By essebi on Jul 02, 2008

All the credits of this snippets goes to the original poster: Daveoh, and the original work can be found here: http://www.hawkee.com/snippet/2041/

I edited it with wildcard for automatically catch every url on the chan and convert it into a tinyurl. You can think this edit is useless, but on my chan is really appreciated.

I've removed all triggers, and of course need to loaded on a bot.

Cheers
essebi

on *:TEXT:*http*:*:{
  if (%tinyspam) { halt }
  if (*http://tinyurl* iswm $1-) { halt }
  set -u3 %tinyspam 1
  set %tinyurlchan $chan
  var %tinytemp $1-
  set %tinyurl1 $wildtok(%tinytemp,http*,1,32)
  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 %tinyurl2 }
    else { echo -a Accorciato in %tinyurl2 }
    unset %tinyurl*
  } 
  goto nextread 
} 

Comments

Sign in to comment.
jasonh   -  Jul 26, 2010

Thanks for this! works great.

 Respond  
miniCruzer   -  Sep 03, 2009

Well done, sir.

 if (%tinyurlchan) { msg %tinyurlchan 0,12TinyURL: 12 $+ %tinyurl2 $+  0,4Original: 12 $+ %tinyurl1 }

(line 34)

 Respond  
VinX   -  Jul 31, 2009

{ msg %tinyurlchan %tinyurl2 }

should i change there in order to give it color or make it bold ?

like

{ msg ,,%tinyurlchan %tinyurl2 ,,}

 Respond  
SuPeRFlY   -  Aug 28, 2008

just an update .. this script works perfect .. sorry for the doubts :)

 Respond  
SuPeRFlY   -  Aug 26, 2008

Is there a way to actualy make this work?. I typed in an HTTP url and this didn't do anything. looks like a great tool to have. maybe i'm missing something?

 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.