Advertisement
Guest User

Ford_Lawnmower / Nonciclopedia search

a guest
Nov 19th, 2010
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. ;Nonciclopedia Search Script by Ford_Lawnmower -- irc.GeekShed.net #Script-Help
  2. menu Channel,Status {
  3. .$iif($group(#nonciclopedia) == On,$style(1)) Nonciclopedia Nonciclopedia Trigger
  4. ..$iif($group(#nonciclopedia) == On,$style(2)) On: .enable #nonciclopedia
  5. ..$iif($group(#nonciclopedia) == Off,$style(2)) Off: .disable #nonciclopedia
  6. }
  7. #nonciclopedia on
  8. On $*:Text:/^(!|@)nonciclopedia.*/Si:#: {
  9. if ($timer($+(nonciclopedia,$network,$nick))) { return }
  10. .timer $+ $+(nonciclopedia,$network,$nick) 1 4 noop
  11. var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
  12. nonciclopediaS %method $2-
  13. }
  14. #nonciclopedia end
  15. alias nonciclopedia { nonciclopediaS echo -a $1- }
  16. alias -l nonciclopediaS {
  17. $1-2 Searching.......
  18. var %sockname $+(nonciclopediaS,$network,$2,$ticks)
  19. sockopen %sockname nonciclopedia.wikia.com 80
  20. sockmark %sockname $1-2 $iif($3,$+(/wiki/Speciale:Ricerca/,$replace($3-,$chr(32),_)),/wiki/Speciale:PaginaCasuale) 0 $iif(!$3,1,0)
  21. }
  22. alias -l nonciclopediaR {
  23. var %sockname $+(nonciclopediaR,$network,$2,$ticks)
  24. sockopen %sockname nonciclopedia.wikia.com 80
  25. sockmark %sockname $1-2 $+(/wiki/,$3) 0 $iif($4,1,0)
  26. }
  27. On *:sockopen:nonciclopedia*: {
  28. if (!$sockerr) {
  29. sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
  30. sockwrite -n $sockname Host: nonciclopedia.wikia.com
  31. sockwrite -n $sockname $crlf
  32. }
  33. else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  34. }
  35. On *:sockread:nonciclopediaS*: {
  36. if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  37. else {
  38. var %nonciclopediaS | sockread %nonciclopediaS
  39. if (Page title matches isincs %nonciclopediaS) { sockmark $sockname $puttok($sock($sockname).mark,1,4,32) }
  40. if (Page text matches isincs %nonciclopediaS) { sockmark $sockname $puttok($sock($sockname).mark,1,4,32) }
  41. ;if ($gettok($sock($sockname).mark,4,32)) && ($regex(%nonciclopediaS,/\Q<li><a href="/wiki/\E(.*)\Q" title="\E/)) {
  42. if ($regex(%nonciclopediaS,/<li><a href="(?:http://nonciclopedia.wikia.com)?/wiki/([^"]*)"/i)) {
  43. nonciclopediaR $gettok($sock($sockname).mark,1-2,32) $regml(1)
  44. sockclose $sockname
  45. return
  46. }
  47. if (Location: isin %nonciclopediaS) {
  48. nonciclopediaR $gettok($sock($sockname).mark,1-2,32) $nopath(%nonciclopediaS) $gettok($sock($sockname).mark,5,32)
  49. sockclose $sockname
  50. return
  51. }
  52. }
  53. }
  54. On *:sockread:nonciclopediaR*: {
  55. if ($sockerr) { echo -st socket error $nopath($script) }
  56. else {
  57. var %nonciclopediaR | sockread %nonciclopediaR
  58. if (*<p>*<b>* iswm %nonciclopediaR) {
  59. sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,4,32) + 1),4,32)
  60. }
  61. if ($gettok($sock($sockname).mark,4,32)) && ($httpstrip(%nonciclopediaR)) {
  62. put $gettok($sock($sockname).mark,1-2,32) $fix&#($v1) $+(,http://nonciclopedia.com,$gettok($sock($sockname).mark,3,32))
  63. sockclose $sockname
  64. return
  65. }
  66. }
  67. }
  68. On *:sockclose:nonciclopedia*: {
  69. if ($gettok($sock($sockname).mark,5,32)) && (nonciclopediaR* iswm $sockname) { nonciclopediaS $gettok($sock($sockname).mark,1-2,32) }
  70. else { $gettok($sock($sockname).mark,1-2,32) Sorry No results found for your Search }
  71. }
  72. alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | return $remove($replace(%x,&amp;,&),&nbsp;,&mdash;) }
  73. alias -l Put {
  74. if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
  75. var %tokens $0, %Tstart 3, %Dtimer 1500
  76. if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
  77. while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
  78. dec %tokens
  79. if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
  80. .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  81. inc %Dtimer 1500
  82. %Tstart = $calc(%tokens + 1)
  83. %tokens = $0
  84. }
  85. }
  86. .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
  87. .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
  88. }
  89. alias -l fix&# { return $replace($regsubex($1-,/\&\#([0-9]{1,});/g,$UTF8(\t)),&quot;,",&amp;,&,&gt;,>,&lt;,<,&#39;,',|,,$chr(9),$chr(32)) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement