mIRC_Wiki

By sidik999 on Nov 03, 2008

This is a simple script to enable users in channel to ask id.wikipedia.org (Wikipedia Indonesia)
and the answer will send through notice.
Many thanks to :

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;mIRC_Wiki
;By Sidik on irc.myquran.org #myquran
;Last updated: 20081031
;Thanks for Meij n Sanjisan
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

;Semua code ALIAS taruh di bawah ini 
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
alias socket.wik {
  sockclose sockwik
  sockopen sockwik id.wikipedia.org 80
} 

alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
  return %x
} 

alias -l _encode {
  var %s, %p = $len($1-)
  while (%p) {
    if ($mid($1-,%p,1) isalnum) { %s = $+($ifmatch,%s) }
    else { %s = $+(%,$base($asc($mid($1-,%p,1)),10,16),%s) }
    dec %p
  }
  return %s
}

;Semua code ON taruh di bawah ini 
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
on *:text:!wiki *:#: {
  set %wikichan $chan
  set %wikicari $2-
  set %wikinick $nick
  set %wikino1 0
  set %wikino2 Wikipedia tidak memiliki artikel

  /socket.wik
}

on *:sockopen:sockwik:{
  tokenize 32 $sock($sockname).mark
  if ($sockerr) {
    echo -a [debuging] $sockname Unable to open connection
    echo -a [debuging] $sockname $1-
    sockclose $sockname
    return
  }

  ;echo -a [debuging] $+(/w/index.php?title=,$_encode(%wikicari),&redirect=yes)
  sockwrite -nt $sockname GET $+(/w/index.php?title=,$_encode(%wikicari),&redirect=yes) HTTP/1.0
  sockwrite -nt $sockname Accept-Language: id
  sockwrite -nt $sockname User-Agent: mIRC_Wiki/Beta
  sockwrite -nt $sockname Referer: http://id.wikipedia.org
  sockwrite -nt $sockname Host: id.wikipedia.org
  sockwrite -nt $sockname Connection: close
  sockwrite -t $sockname $str($crlf,2)
} 

on *:sockread:sockwik:{
  var %kode | sockread %kode

  ;kalo mo liat aslinya pake View Page Source di Firefox
  if (<p><b> isin %kode) { 
    ;timer 1 1 msg %wikichan [Wiki] $+(%wikinick,:) $nohtml(%kode) 
    notice %wikinick [Wiki] $nohtml(%kode) 
  }

  if (%wikino2 isin $nohtml(%kode)) {
    set %wikino1 1
  }
} 

on *:sockclose:sockwik: { 
  if (%wikino1 == 0) {
    ;msg %wikichan $+([Wiki] disalin dari http://id.wikipedia.org/wiki/,%wikicari) 
    notice %wikinick $+([Wiki] disalin dari http://id.wikipedia.org/wiki/,$_encode(%wikicari)) 
  }
}

Comments

Sign in to comment.
sidik999   -  Nov 17, 2008

thx to xOtic

 Respond  
xOtic   -  Nov 15, 2008

digi23!!! are you serious?? change the id (indonesia) to a en (english)

well done!

peace!!!!

 Respond  
digi23   -  Nov 15, 2008

can it retrive in english laguage?

 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.