Wikipedia Search (English Version)

By CommonKnowledge on Mar 15, 2013

This is Not my Code. This code was posted by Sidik999 (http://www.hawkee.com/snippet/5312/) I just edited a few simple things making this an English version of the script for others to use.

;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;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 en.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: en
  sockwrite -nt $sockname User-Agent: mIRC_Wiki/Beta
  sockwrite -nt $sockname Referer: http://en.wikipedia.org
  sockwrite -nt $sockname Host: en.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 say %wikichan $+(%wikinick,:) $nohtml(%kode) 
    say %wikichan  $nohtml(%kode) 
  }

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

on *:sockclose:sockwik: { 
  if (%wikino1 == 0) {
    ;msg %wikichan $+(  http://en.wikipedia.org/wiki/,%wikicari) 
  msg %wikichan $+(  http://en.wikipedia.org/wiki/,$_encode(%wikicari))   }
}

Comments

Sign in to comment.
CommonKnowledge   -  Mar 15, 2013

was also going to add a Strip thing to it so its color compatible, but I got lazy.

 Respond  
CommonKnowledge   -  Mar 15, 2013

Not sure as if it was the best route to go, with both of the MSG's that I added, instead of a notice. But It works.

 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.