Advertisement
westor

Meteorologia addon for nexus v1.0

Nov 26th, 2014
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.22 KB | None | 0 0
  1. ON *:TEXT:*:#: {
  2.   tokenize 32 $strip($1-,burci)
  3.   if ($1 == !akore) {
  4.     if ($2 == $null) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, La forma Correcta de usarlo es !akore <akore>  | return }
  5.     if ($2 !isnum) { .msg $chan [ $+ $nick $+ ]: Error, Incorrect parameters, try again and use only numbers! | return }
  6.     sockget http://meteorologia.gov.py/interioradatos.php?depto= $+ $2 $nick $chan
  7.   }
  8. }
  9.  
  10. alias sockget {
  11.   if (!$1-) { echo -ag ERROR: Enter the URL Page correctly! | return }
  12.   var %s = sockget_ $+ $rand(1,100000)
  13.   if ($sock(%s)) { sockclose %s }
  14.   var %site = $1-
  15.   var %get_host = $chr(47) $+ $gettok(%site,3-,47)
  16.   var %host = $gettok(%site,2,47)
  17.   if ($right(%site,1) == $chr(47)) && ($right(%get_host,1) !== $chr(47)) { var %get_host = %get_host $+ $chr(47) }
  18.   if (*https* iswm %site) { sockopen -e %s %host 443 }
  19.   else { sockopen %s %host 80 }
  20.   sockmark %s %get_host $2 $3
  21. }
  22.  
  23. ON *:SOCKOPEN:sockget_*: {
  24.   if ($sockerr) {
  25.     var %n = $gettok($sock($sockname).mark,2,32)
  26.     var %c = $gettok($sock($sockname).mark,3,32)
  27.     if ($me !ison %c) { return }
  28.     if (%n !ison %c) { return }
  29.     .msg %c [ $+ %n $+ ]: Error, There was an connection problem to the website. - (Error Code:  $+ $sock($sockname).wserr $+ ) - (Error Message:  $+ $sock($sockname).wsmsg $+ )
  30.     sockclose $sockname
  31.     return
  32.   }
  33.   sockwrite -nt $sockname GET $gettok($sock($sockname).mark,1,32) HTTP/1.0
  34.   sockwrite -n $sockname Host: $sock($sockname).addr
  35.   sockwrite -n $sockname User-Agent: */*
  36.   sockwrite -n $sockname Connection: Close
  37.   sockwrite -nt $sockname $crlf
  38. }
  39.  
  40. ON *:SOCKREAD:sockget_*: {
  41.   if ($sockerr) {
  42.     var %n = $gettok($sock($sockname).mark,2,32)
  43.     var %c = $gettok($sock($sockname).mark,3,32)
  44.     if ($me !ison %c) { return }
  45.     if (%n !ison %c) { return }
  46.     .msg %c [ $+ %n $+ ]: Error, There was an connection reading problem to the website. - (Error Code:  $+ $sock($sockname).wserr $+ ) - (Error Message:  $+ $sock($sockname).wsmsg $+ )
  47.     sockclose $sockname
  48.     return
  49.   }
  50.   var %read
  51.   sockread %read
  52.   if ($sockbr) {
  53.     ; echo -ag DATA: %read
  54.     if (*<span class="Estilo24"><span class="Estilo31">* iswm %read) {
  55.       var %n = $gettok($sock($sockname).mark,2,32)
  56.       var %c = $gettok($sock($sockname).mark,3,32)
  57.       if ($me !ison %c) { return }
  58.       if (%n !ison %c) { return }
  59.       .msg %c$httpstrip(%read)
  60.     }
  61.     if (*<div align="right" class="Estilo10">* iswm %read) && (*</div></td>* iswm %read) && (!%read2_ [ $+ [ $sockname ] ]) {
  62.       var %n = $gettok($sock($sockname).mark,2,32)
  63.       var %c = $gettok($sock($sockname).mark,3,32)
  64.       if ($me !ison %c) { return }
  65.       if (%n !ison %c) { return }
  66.       set -e %read2_ [ $+ [ $sockname ] ] 1
  67.       .msg %c$httpstrip(%read)
  68.     }
  69.     if (*<td height="29" colspan="2"><div align="center"><span class="Estilo5">* iswm %read) {
  70.       var %n = $gettok($sock($sockname).mark,2,32)
  71.       var %c = $gettok($sock($sockname).mark,3,32)
  72.       if ($me !ison %c) { return }
  73.       if (%n !ison %c) { return }
  74.       .msg %c$httpstrip(%read)
  75.     }
  76.     if (*<div align="center" class="Estilo24">* iswm %read) {
  77.       var %n = $gettok($sock($sockname).mark,2,32)
  78.       var %c = $gettok($sock($sockname).mark,3,32)
  79.       if ($me !ison %c) { return }
  80.       if (%n !ison %c) { return }
  81.       var %text = $httpstrip(%read)
  82.       var %text = $replace(%text,&oacute;,ó)
  83.       .msg %c%text
  84.     }
  85.     if (*<td width="79" class="Estilo5 Estilo2 Estilo3">* iswm %read) {
  86.       var %n = $gettok($sock($sockname).mark,2,32)
  87.       var %c = $gettok($sock($sockname).mark,3,32)
  88.       if ($me !ison %c) { return }
  89.       if (%n !ison %c) { return }
  90.       .msg %c$httpstrip(%read)
  91.     }
  92.     if (*<td width="85" class="Estilo5 Estilo2 Estilo3">* iswm %read) {
  93.       var %n = $gettok($sock($sockname).mark,2,32)
  94.       var %c = $gettok($sock($sockname).mark,3,32)
  95.       if ($me !ison %c) { return }
  96.       if (%n !ison %c) { return }
  97.       .msg %c$httpstrip(%read)
  98.     }
  99.     if (*<td width="87" class="Estilo5 Estilo2 Estilo3">* iswm %read) {
  100.       var %n = $gettok($sock($sockname).mark,2,32)
  101.       var %c = $gettok($sock($sockname).mark,3,32)
  102.       if ($me !ison %c) { return }
  103.       if (%n !ison %c) { return }
  104.       .msg %c$httpstrip(%read)
  105.     }
  106.     if (*<td><div align="center" class="Estilo4"><span class="Estilo51">* iswm %read) && (!%read8_ [ $+ [ $sockname ] ]) {
  107.       var %n = $gettok($sock($sockname).mark,2,32)
  108.       var %c = $gettok($sock($sockname).mark,3,32)
  109.       if ($me !ison %c) { return }
  110.       if (%n !ison %c) { return }
  111.       set -e %read8_ [ $+ [ $sockname ] ] 1
  112.       .msg %c$httpstrip(%read)
  113.     }
  114.   }
  115. }
  116.  
  117. ON *:SOCKCLOSE:sockget_*: {
  118.   unset %read2_ [ $+ [ $sockname ] ] %read8_ [ $+ [ $sockname ] ]
  119.   ; echo -ag CLOSED: $sock($sockname).addr SOCKET CONNNECTION!
  120. }
  121.  
  122. alias httpstrip {
  123.   var %xx = $replace($1-,&#x26;,$chr(38),$chr(124),-,$chr(125),-,&#125;,-,&#124;,-,&quot;,$chr(34),&amp;,&,&lt;,<,&gt;,>,&nbsp;,$chr(32),&#x26;#039;,$chr(39),$chr(13),$chr(32))
  124.   var %x = $remove(%xx,<![CDATA[,]]>,$chr(2),$chr(4),$chr(9),$chr(31),$chr(22),$chr(29),$chr(10),$chr(13))
  125.   var %i = $regsub(%x,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  126.   return %x
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement