TinyURL Previewer

By PowerScripters on Jan 09, 2010

Image

== TinyURL-Previewer ==

If somebody posts a TinyURL the Bot shows the URL behind.
So you cannot be trapped by illegal, virus or malware Pages. [Like nimp]

The URL uses the On *:TEXT: Trigger and automatically finds the $1,2,3-String where the URL is stored.

Defined %mirc.temp as Local, so it won't mess up with other scripts.
Fixed that lazy sockclose bug.

#### Get TinyURL-Links and convert them.
alias tinyurl-connection { 
  set %tinyurl-c $remove($1,http://,www.,tinyurl.com)
  set %tinyurl-full $1
sockopen tinyurl tinyurl.com 80 }
on *:SOCKOPEN:tinyurl:{

  ; connection
  sockwrite -n $sockname GET %tinyurl-c HTTP/1.1
  ; Write Connection Details
  sockwrite -n $sockname Host: preview.tinyurl.com
  sockwrite -n $sockname $crlf 

}
on *:SOCKREAD:tinyurl:{
var %mirc.temp 0
  sockread %mirc.temp
  if (<blockquote><b> isin %mirc.temp) {
    msg %tinyurl-chan 00,02TinyURL ( $+ %tiny-full $+ ) redirects to: $remove(%mirc.temp,<blockquote>,<b>,</b>,<br />,</blockquote>)
  }
}
on *:SOCKCLOSE:tinyurl:{ unset %tinyurl-* }
on *:TEXT:*:#:{
sockclose tinyurl
  set %tinyurl-chan $chan
  var %i 1
  while ([ $chr(36) $+ [ %i ]  ]) {
    if (tinyurl.com/ isin [ $chr(36) $+ [ %i ]  ]) { tinyurl-connection [ $chr(36) $+ [ %i ]  ] }
    inc %i
  }
}

## PowerScripters for President.

Comments

Sign in to comment.
cj42057   -  Apr 22, 2013

nice idea and thanks for sharing , might want to remove line 20 from the code listed about and this will work perfectly, otherwise it will try and double msg the decoded url to the channel, just a heads up. =)

 Respond  
cptpan   -  Jul 11, 2012

I know what it's supposed to do. It doesn't do it.

 Respond  
blackvenomm666   -  Jul 09, 2012

cptpan what it does it tells you where the tinyurl that is posted in a chan really goes to. but the html could have changed if it's not working or your using it wrong

 Respond  
cptpan   -  Jul 09, 2012

This doesn't do anything?

 Respond  
Dodge   -  Jun 11, 2012

I changed it to echo instead of msg. Handy script for me wd. 7/10

 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.