Title Retreiver

By Ghost-writer on Aug 04, 2010

Basically, gets the title of urls posted in channels, useful for when some guy posts a rick roll :P.

on $*:TEXT:/(www\S+|http\S+)/Si:#: urltrack # $regml(1)
alias urltrack {
  var %name $ticks
  if ($2) {
    set %chanurltrack [ $+ [ %name ] ] $1
    tokenize 32 $2-
  }
  sockopen urltrack $+ %name $gettok($remove($1,http://),1,47) 80
  sockmark urltrack $+ %name $gettok($remove($1,http://),1,47) $gettok($remove($1,http://),2-,47) 
}
on *:SOCKOPEN:urltrack*: {
  sockwrite -nt $sockname GET / $+ $gettok($sock($sockname).mark,2,32) HTTP/1.1
  sockwrite -nt $sockname Host: $gettok($sock($sockname).mark,1,32)
  sockwrite -nt $sockname $crlf 
}
on *:SOCKREAD:urltrack*: {
  if (!$sockerr) {
    var %Quote
    sockread %Quote
    if (title isin %quote) {
      var %quote $remove(%quote,$chr(9)), %chan %chanurltrack [ $+ [ $remove($sockname,urltrack) ] ]
      if (content=" isin %quote) echo %chan 04**14(07Site14) 14(07 $+ $replace($sock($sockname).mark,$chr(32),/) $+ 14)07 $gettok(%quote,4,34)
      elseif ($len($nohtml(%quote)) > 5) echo %chan 04**14(07Site14) 14(07 $+ $replace($sock($sockname).mark,$chr(32),/) $+ 14)07 $nohtml(%quote)
      else echo %chan Error: %quote
      sockclose $sockname
    }
  }
}

Comments

Sign in to comment.
Jethro   -  Aug 04, 2010

Your regex will trigger upon wwwwwwwwwwwwww or httpppppppppppp or whatever follows 'em. You should at least make it as so:

/\s\b(http\72\/\/|w{3}\.)\S+\.\S{2,3}\b/Si

Making sure it validates a legit URL.

 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.