Kod: Kodu kopyalamak için üzerine çift tıklayın!
alias conv {
return $replace($1-,\u00fc,ü, \u015f, ş, \u011f, ğ, \u00e7, ç, \u00c7, Ç, \u00e2, â, \u0131, ı, \u0130, i, \u00f6, ö, \u015e, Ş)
}
alias wiki {
if ($1 == $null) { echo -a Lütfen bir arama terimi girin. | return }
var %term = $replace($1-, $chr(32), %20)
sockclose wiki
sockopen -e wiki tr.wikipedia.org 443
set %wikiterm %term
}
on *:sockopen:wiki:{
if ($sockerr > 0) { echo -a HATA: $sock($sockname).wsmsg ** sock($sockname).wserr | return }
sockwrite -n $sockname GET /w/api.php?action=query&prop=extracts&exintro&explaintext&format=json&titles= $+ %wikiterm HTTP/1.1
sockwrite -n $sockname Host: tr.wikipedia.org
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
}
on *:sockread:wiki:{
var %tmp
sockread %tmp
if (%tmp != $null) {
if ($regex(%tmp, /"extract":"([^"]+)"/)) {
var %summary = $regml(1)
echo -a Wikipedia özeti: $conv($replace(%summary, \n, $crlf))
}
}
}