<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13031" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-01-27T20:30:45-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13031</id>

		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2007-01-27T20:30:45-04:00</updated>

		<published>2007-01-27T20:30:45-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69994#p69994</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69994#p69994"/>
		<title type="html"><![CDATA[Bug in Google.tcl by  eRUPT]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69994#p69994"><![CDATA[
Any Tcl errors?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sat Jan 27, 2007 8:30 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[slot]]></name></author>
		<updated>2007-01-27T14:32:30-04:00</updated>

		<published>2007-01-27T14:32:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69985#p69985</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69985#p69985"/>
		<title type="html"><![CDATA[Bug in Google.tcl by  eRUPT]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69985#p69985"><![CDATA[
Hi, could someone please tell me where the Bug is? define works perfect! but swtich search stops at regexp! i dont know why.<br><br>heres the code <div class="codebox"><p>Code: </p><pre><code># Title: Google TCL For eggdrop## Description: Searches google.com for url results via search terms## Features: Multiple result urls, Can set number of results to return## Author: eRUPT(erupt@ruptbot.com)########################### Version History## - 0.1b -# First Release## - 0.2 -# Fixed Googles browser checking features.## - 0.3 -# Fixed Googles new formatting## - 0.4 -# Fixed Categories showing as first result.## - 0.5 -# Added option to limit channels script can be used on.## - 0.6 -# Fixed Googles new formatting# Added Page titles to results if a page title exists.## - 0.7 -# Rewrote the whole text grabbing code.# Added entity code replacing.## - 0.8 -# Rewrote pattern matching.# Added "Define: &lt;word&gt;" support##########################set google(MAX) 10set google(deny_CHANS) {  #channel1  #channel2}set google(VER) 0.8package require httpbind pub - !google pub_googleproc html_replace {quotes} {  regsub -all {‘|‘} $quotes "\`" quotes  regsub -all {’|’} $quotes "\'" quotes  foreach index [lsort -decreasing [regexp -all -indices -inline {&amp;#[0-9]+;} $quotes]] {     set binary_value [string range $quotes [lindex $index 0] [lindex $index 1]]     regexp {[0-9]+} $binary_value match     set quotes [string replace $quotes [lindex $index 0] [lindex $index 1] [format %c $match]]  }  return $quotes}proc pub_google {nick uhost hand chan arg} {  global google  if {[lsearch [string tolower $google(deny_CHANS)] [string tolower $chan]]!="-1"} {    return 0  }  if {$arg==""} {    putnot $nick "Usage: !google &lt;search terms&gt;"    putnot $nick "Flags: -c1(Results to return) -a(Boolean And)"    putnot $nick "(Use define: prefix to query definitions)"    return 0  }  set type q  set results 1  foreach flag $arg {    if {$flag=="-a"} { set type as_q ; continue } else {      if {[regexp -- {-c[0-9]*} $flag]} {set results [string range $flag 2 end]        continue      }    }    lappend search $flag  }  if {$results&gt;$google(MAX)} {    putnot $nick "Max results allowed is \002$google(MAX)\002, omitting extra"    set results $google(MAX)  }  search_google $chan $results $type $search}proc search_google {chan results type search} {  regsub -all " " $search "+" search  if {[string match -nocase define:* $search]} {    set extra &amp;oi=glossary_definition    set result dict    regsub {[Dd]efine:} $search {define:} search  } else {    set extra ""    set result search  }  set url http://www.google.com/search?$type=$search&amp;num=$results$extra  http::config -useragent "Mozilla/5.0"  set conn [http::geturl $url -headers "Referer http://www.google.com"]  set data [http::data $conn]  set count 0  regsub -all {&lt;b&gt;|&lt;/b&gt;} $data \002 data  switch $result {search {  foreach {match url desc} [regexp -all -inline {&lt;p class=g&gt;&lt;a class=l href="([^"]*)"&gt;([^&lt;]*)&lt;/a&gt;} $data] {      set desc [html_replace $desc]     if {$count==$results} { break }    incr count 1      if {$results&gt;1} {         putserv "PRIVMSG $chan :Result($count): \002$url\002 ($desc)"       } else { putserv "PRIVMSG $chan :Result: \002$url\002 ($desc)" ; break }    }}dict {          foreach {match desc} [regexp -all -inline {&lt;li&gt;([^&lt;]*)&lt;br&gt;} $data] {            set desc [html_replace $desc]            if {$count==$results} { break }            incr count 1            if {$results&gt;1} {              putserv "PRIVMSG $chan :Result($count): $desc"            } else { putserv "PRIVMSG $chan :Result: $desc" ; break }          }}  }  if {$count!=$results} {    putserv "PRIVMSG $chan :Only could find \002$count\002 results"  }}putlog "Google script $google(VER) by erupt loaded"</code></pre></div>thanks<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6343">slot</a> — Sat Jan 27, 2007 2:32 pm</p><hr />
]]></content>
	</entry>
	</feed>
