Advertisement
illpastethat

URL fetch for MooMoo

Dec 18th, 2011
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 3.17 KB | None | 0 0
  1. ;I didn't actually make this, just some small changes
  2. ;you can do !nolinks NICK to block specific people (like google bots I do this for)
  3. ;you can do !noparse TITLE to block specific website titles (like Google because it's used a lot)
  4. On *:input: {
  5.   if (($1 == !noparsetitle) || ($1 == !noparse) || ($1 == !dontparsetitle) || ($1 == !noparsetitles) || ($1 == !dontparsetitles)) {
  6.     set %dontparsetitles $addtok(%dontparsetitles,$2-,44)
  7.     echo -ac info I wont be parsing for the website title $2- anymore...
  8.   }
  9.   elseif ($1 == !nolinks) {
  10.     set %nolinks $addtok(%nolinks,$iif(($2),$2,$active),44)
  11.     echo -ac info I wont be parsing links from $iif(($2),$2,$active) anymore...
  12.   }
  13. }
  14. on *:TEXT:*:#: {
  15.   if ((!$istok(%nolinks,$nick,44)) && (*powerbot.org* !iswm $1-)) {
  16.     rtc $chan $1-
  17.   }
  18. }
  19. on *:ACTION:*:#: rtc $chan $1-
  20. on *:sockopen:website.*: {
  21.   if (!$sockerr) {
  22.     tokenize 32 $($+(%,$sockname),2)
  23.     sockwrite -n $sockname GET $2 HTTP/1.1
  24.     sockwrite -n $sockname Host: $1
  25.     sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
  26.     sockwrite -n $sockname Accept: */*
  27.     sockwrite -n $sockname Connection: Close
  28.     sockwrite -n $sockname $crlf
  29.   }
  30.   else unset $+(%,$sockname)
  31. }
  32. on *:sockread:website.*: {
  33.   var %x, %z = $sockname, %e = $($+(%,%z),2)
  34.   sockread -f %x
  35.   if ($regex(%x,/<title[\w\s="]*>(.*?)<\/title>/i)) {
  36.     tokenize 32 %e
  37.     var %s = $btc(Url:) $+(http://,$+($1,$iif($2 != /,$2))) - $btc(Title:) $ptc($regml(1)) $iif($4,$4)
  38.     if ((!$istok(%dontparsetitles,$ptc($regml(1)),44)) && (*powerbot.org/vb/showthread.php?t=* !iswm $+(http://,$+($1,$iif($2 != /,$2))))) {
  39.       msg $3 10 $iif(c isincs $chan($3).mode,$strip(%s),%s) 12By4 %urlnick
  40.     }
  41.     unset $+(%,$(%z,2))
  42.     .sockclose %z
  43.   }
  44.   if (*HTTP*302* iswm %x) set -e %web.tmp 1
  45.   if (Location: isin %x) {
  46.     if ($mtc(%x)) {
  47.       tokenize 32 %e
  48.       sockclose %z
  49.       soc $regml(web,1) $iif($regml(web,2),$v1,/) $iif($3,$3,1) %z $iif(%web.tmp,Redirected)
  50.       unset %web.tmp
  51.     }
  52.   }
  53. }
  54. on *:sockclose:website.*: unset $+(%,$sockname)
  55. alias -l soc {
  56.   var %x = $iif($4,$4,$+(website.,$r(a,z),$r(a,z),$r(a,z),$r(0,9),$r(0,9),$r(0,9)))
  57.   set -e $+(%,%x) $1-2 $iif($3 ischan && $me ison $3,$3) $iif($5,$ntc($5))
  58.   sockopen %x $1 80
  59. }
  60. alias -l mtc return $regex(web,$1,/(?:https?:\/\/)?((?:www\.)?[\w-.]+\.(?>[a-z]{2,4})(?![a-z]))([\w-_#?=%.\/&?]+)?/ig)
  61. alias -l ptc return $replacecs($1,&mdash;,-,&quot;,",&amp;,&,&lt;,<,&gt;,>,�,$chr(233),�,$chr(231),&ccedil;,$chr(231),&ntilde;,$chr(241),�,$chr(209),�,$chr(220),�,$chr(244))
  62. alias -l btc return $+($chr(2),$1,$chr(2))
  63. alias -l ntc return $+($chr(40),$1,$chr(41))
  64. alias rtc {
  65.   if (*youtube.com* !iswm $1-) {
  66.     if ($mtc($2-)) && (!%website.flood [ $+ [ $regml(web,1) ] ]) {
  67.       set %urlnick $nick
  68.       set %urlnetwork $network
  69.       var %x = 1, %v
  70.       while ($regml(web,%x)) {
  71.         var %z = $iif(/ isin $regml(web,$calc(%x +1)),$v2,/), %i = $regml(web,%x)
  72.         if (/ !isin %i) && (!$istok(%v,%i,32)) {
  73.           soc %i %z $1
  74.           %v = %v %i
  75.         }
  76.         inc %x 1
  77.       }
  78.       set -eu5 %website.flood $+ $regml(web,1) 1
  79.     }
  80.   }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement