URL Shortener

URL Shortener

mIRC snippet that it shortens your URLs using TinyURL and displays the new shortened URL. !shorten URL

Postat de Copyright Categorie Review user Vizualizari Data
BLKoldSUN manish sockopen Cod netestat 519 2023-12-04 20:29:49

alias isurl return $iif($regex($1-,/(^@S+|www.S+|http://S+|irc.S+|irc://S+|w+(?:[.-]w+)?@w+(?:[.-]w+)?.[a-z]{2,4})/gi),$iif($prop,$regml($v1),$true))
alias -l tiny {
  if ($1) && ($isurl($1)) {
    set %p 0
    sockclose Tinyurl
    set %TinyurlURL /create.php?source=indexpage&url= $+ $1- $+ &submit=Make+TinyURL%21&alias=
    sockopen Tinyurl tinyurl.com 80
  }
  elseif ( !$isurl($1) ) { 
    if (# isin %nick) { msg %nick Invalid url or no url given! }
    else { notice %nick Invalid url or no url given! }
  }
} 
on *:TEXT:!shorten*:#: {
  set %nick $chan
  tiny $2-
}

alias shorten { 
  set %nick $me
  tiny $1-
}

on *:TEXT:!shorten*:?:{
  set %nick $nick
  tiny $2-
}

on *:SOCKOPEN:Tinyurl: {
  sockwrite -n Tinyurl GET %TinyurlURL HTTP/1.1
  sockwrite -n Tinyurl Host: tinyurl.com
  sockwrite Tinyurl $crlf
}
on *:SOCKREAD:Tinyurl: {
  sockread %Tinyurl
  while ($sockbr) {
    if (<div class="indent"><b> isin %Tinyurl) && (%p == 0) { 
      if ($chr(35) isin %nick ) { msg %nick 3 Your URL Has been Shortened To $+ :11 $gettok($right(%Tinyurl,-31),1,60) . }
      else { notice %nick 3 Your URL Has been Shortened To $+ :11 $gettok($right(%Tinyurl,-31),1,60) . }
      unset %p
    }
    sockread %Tinyurl
  }
}