Bradjoe96
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bradjoe96


 
HomeSearchLatest imagesRegisterLog in

 

 Wikipedia Search Script

Go down 
2 posters
AuthorMessage
bradjoe96
Founder
Founder
bradjoe96


Warning Level : Wikipedia Search Script WarningBar-Gloss1
Posts : 159
Points : 69357
Reputation : 600
Join date : 2009-03-29
Age : 28
Location : United States

Wikipedia Search Script Empty
PostSubject: Wikipedia Search Script   Wikipedia Search Script Icon_minitimeMon Aug 31, 2009 10:00 am

Code:

;Wikipedia script by Ford_Lawnmower -- irc.mindforge.org #USA-Chat
On $*:Text:/(^[!@])wiki +/Si:#: {
  if ($regml(1) == @) && ($nick isop $chan) {
    var %sockname $+(wiki,$network,$chan)
    sockclose %sockname
    sockopen %sockname en.wikipedia.org 80
    sockmark %sockname .msg $chan $fixurl($formaturl($2-))
  }
  else {
    if (!$timer(wiki $+ $nick)) {
      .timer $+ $+(wiki,$nick) 1 10 noop
      var %sockname $+(wiki,$network,$chan)
      sockclose %sockname
      sockopen %sockname en.wikipedia.org 80
      sockmark %sockname .notice $nick $fixurl($formaturl($2-))
    } 
  }
}
On *:Sockopen:wiki*: {
  sockwrite -nt $sockname GET $+(/w/index.php?title=,$gettok($sock($sockname).mark,3,32),&redirect=yes) HTTP/1.1
  sockwrite -n $sockname User-Agent: Opera 9.6
  sockwrite -n $sockname Host: en.wikipedia.org $+ $str($crlf,2)
}
on *:sockread:wiki*: {
  if ($sockerr > 0) { echo -at >Sock Error< Wikipedia | sockclose $sockname }
  else {
    sockread -n &wiki
    if $bvar(&wiki, 0) {
      if ($bintween(&wiki,<b>,</p>,1)) {
        var %msgs $gettok($sock($sockname).mark,1,32), %targets $gettok($sock($sockname).mark,2,32)
        bset -t &result 1 $bvar($bintween(&wiki,<p>,</p>,1), 1, $bvar(&wiki, 0)).text
        if (may refer to: isin $bvar($binstrip(&result),1,429).text) {
          %msgs %targets Nothing Found! Please refine your search and check your spelling.
          sockclose $sockname
          halt
        }
        %msgs %targets $bvar($binstrip(&result),1,429).text $iif($bvar(&result, 0) > 429,-,$null)
        if ($bvar(&result, 0) > 429) { %msgs %targets $bvar(&result,430,858).text $iif($bvar(&result, 0) > 858,..,$null) }
        %msgs %targets $+(http://en.wikipedia.org/w/index.php?title=,$gettok($sock($sockname).mark,3,32),&redirect=yes)
        sockclose $sockname
      }
    }
  }
}
alias -l binstrip {
  while ($bfind($1, 1 ,<)) && ($bfind($1, 1, >)) {
    var %first = $bfind($1, 1, <), %last $calc($bfind($1, 1, >) - $bfind($1, 1, <) + 1)
    noop = $bremove($1, $bvar($1, %first, %last).text)
  }
  while ($bfind($1, 1 ,$chr(91))) && ($bfind($1, 1, $chr(93))) {
    %first = $bfind($1, 1, $chr(91))
    %last = $calc($bfind($1, 1, $chr(93)) - $bfind($1, 1, $chr(91)) + 1)
    noop = $bremove($1, $bvar($1, %first, %last).text)
  }
  return $1
}
;bremove by jaytea
alias bremove {
  if (!$isid) || ($0 < 2) || (!$regex($1,/^&[^ ]+$/)) {
    echo -ces i * Invalid parameters: $!bremove
    return
  }
  if ($bvar($1,0)) {
    var %x = 1
    while (%x < $0) {
      inc %x
      var %i = 1, %t = $eval($ $+ %x,2) $chr(32)
      while ($bfind($1,%i,$left(%t,-2)) [ $+ [ $iif($prop == text,.text) ] ]) {
        var %i = $v1, %p = $iif($prop != text && $regex(bremove,%t,/^ *\d+(?: +\d+)* *$/i),$numtok(%t,32),$len($mid(%t,3))) + %i
        if (%p <= $bvar($1,0)) bcopy -c $1 %i $1 %p -1
        elseif ($calc(%i - 1)) bset -c $1 $v1 $bvar($1,$v1)
        else bunset $1
      }
      inc %x 2
    }
  }
  return $1
}
alias -l bintween {
  bunset &tempbin
  var %count = 1, %mark = 0, %mark2 = 0
  while (%count <= $4) {
    if ($bfind($1, %mark2, $2).text) {
      %mark = $calc($bfind($1, %mark2, $2).text + $len($2))
      if ($bfind($1, %mark, $3).text) {
        %mark2 = $bfind($1, %mark, $3).text
      }
      else { return 0 }
    }
    else { return 0 }
    inc %count
  }
  bset -t &tempbin 1 $bvar($1, $iif(%mark > 0,%mark,1), $calc(%mark2 - %mark)).text
  return &tempbin
}
alias -l fixurl return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
alias -l formaturl {
  var %count = $gettok($1-,0,32), %counter = 1, %return
  while (%counter <= %count) {
    if ($regex($gettok($1-,%counter,32),/^us$|^up$|^to$|^so$|^or$|^on$|^of$|^off$|^no$|^it$|^in$|^if$|^go$|^do$|^by$|^be$|^at$|$&
      |^as$|^an$|^is$|^the$|^are$|^there$|^where$|^not$|^and$|^flew$|^over$|^the$|^nest$|^was$/)) {
      %return = %return $gettok($1-,%counter,32)
    }
    else {
      %return = %return $upper($left($gettok($1-,%counter,32),1)) $+ $right($gettok($1-,%counter,32),$calc($len($gettok($1-,%counter,32)) - 1))
    }
    inc %counter
  }
  return $replace($upper($left(%return,1)) $+ $right(%return,$calc($len(%upper) - 1)),$chr(32),_)
Back to top Go down
https://bradjoe96.forumotion.net
Craighton
Moderator
Moderator
Craighton


Warning Level : Wikipedia Search Script WarningBar-Gloss1
Posts : 7
Points : 54978
Reputation : 0
Join date : 2009-06-04
Location : Seattle Washington

Wikipedia Search Script Empty
PostSubject: Re: Wikipedia Search Script   Wikipedia Search Script Icon_minitimeTue Sep 01, 2009 10:43 am

nice script
Back to top Go down
http://thetechsoup.com
bradjoe96
Founder
Founder
bradjoe96


Warning Level : Wikipedia Search Script WarningBar-Gloss1
Posts : 159
Points : 69357
Reputation : 600
Join date : 2009-03-29
Age : 28
Location : United States

Wikipedia Search Script Empty
PostSubject: Re: Wikipedia Search Script   Wikipedia Search Script Icon_minitimeWed Sep 02, 2009 5:45 am

Craighton wrote:
nice script

Not mine... but I don't know who made it so... I just give it out Smile
Back to top Go down
https://bradjoe96.forumotion.net
Craighton
Moderator
Moderator
Craighton


Warning Level : Wikipedia Search Script WarningBar-Gloss1
Posts : 7
Points : 54978
Reputation : 0
Join date : 2009-06-04
Location : Seattle Washington

Wikipedia Search Script Empty
PostSubject: Re: Wikipedia Search Script   Wikipedia Search Script Icon_minitimeThu Sep 03, 2009 6:34 am

That script would get a lot of uses for college students in need of a quick search
Back to top Go down
http://thetechsoup.com
bradjoe96
Founder
Founder
bradjoe96


Warning Level : Wikipedia Search Script WarningBar-Gloss1
Posts : 159
Points : 69357
Reputation : 600
Join date : 2009-03-29
Age : 28
Location : United States

Wikipedia Search Script Empty
PostSubject: Re: Wikipedia Search Script   Wikipedia Search Script Icon_minitimeThu Sep 03, 2009 8:46 am

Craighton wrote:
That script would get a lot of uses for college students in need of a quick search

Yeah, except not many people are into IRC. IRC is kinda getting like AIM.. old..
Back to top Go down
https://bradjoe96.forumotion.net
Sponsored content





Wikipedia Search Script Empty
PostSubject: Re: Wikipedia Search Script   Wikipedia Search Script Icon_minitime

Back to top Go down
 
Wikipedia Search Script
Back to top 
Page 1 of 1
 Similar topics
-
» Away Script
» Advanced Google Bot Search
» Dictionary Script
» TinyURL Script
» Bot Logging Channel Script 5.00

Permissions in this forum:You cannot reply to topics in this forum
Bradjoe96 :: Scripting :: mIRC Scripting-
Jump to: