This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

google tcl v0.2.1 broken :(

Old posts that have not been replied to for several years.
Locked
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

google tcl v0.2.1 broken :(

Post by AxS »

Is anyone able to use the !file trigger? I am no good in parsing, so I don't know how to fix if it is really broken, although i'd love to learn how heheh.
When I use that trigger, nothing happens no matter what i try to search for.

A little fix is what this tcl might need...its this one:

google.tcl v0.2.1 by aNa|0Gue

Many thanx peeps
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

could somebody tell ]Kami[ that this isn't funny ? thats just anoying, like nearly every of his posts...i havent seen any constructive post, only destructive once by him....ppslim do something....or does this forum have an ignore function ?
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

Post by AxS »

Maybe someone could explain what to change so that i can get 5 returns on a search instead of one? I can display the tcl code here if needed. Still doesnt help that the !file trigger is broken :(
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

post the code / a link to that tcl

btw : who deleted the "if its broken dont use it" post by kami ?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

It wasn't me! :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

Post by AxS »

# google.tcl v0.2.1
#
# !google keywords - displays the first related website found from google in the channel
# !image keywords - displays the first related image found on google in the channel
# !file keywords - displays the first mirror download link found on filemirrors in the channel
#
# by aNa|0Gue - analogue@glop.org - http://www.glop.org/
#
# 04/17/2002 v0.2.1 useragent fix by FAN

package require http

bind pub - !google pub:google
bind pub - !image pub:image
bind pub - !file pub:file

set agent "Mozilla"

proc pub:google { nick uhost handle channel arg } {
global agent
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :hey ! tappes des mots boulet !"
} else {
set query "http://www.google.de/search?btnI=&q="
for { set index 0 } { $index<[llength $arg] } { incr index } {
set query "$query[lindex $arg $index]"
if {$index<[llength $arg]-1} then {
set query "$query+"
}
}
#putserv "PRIVMSG $channel :$query"
set token [http::config -useragent $agent]
set token [http::geturl $query]
puts stderr ""
upvar #0 $token state
set max 0
foreach {name value} $state(meta) {
if {[regexp -nocase ^location$ $name]} {
set newurl [string trim $value]
putserv "PRIVMSG $channel :$newurl"
}
}
}
}

proc pub:image { nick uhost handle channel arg } {
global agent
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :hey ! tappes des mots boulet !"
} else {
set query "http://images.google.de/images?btnI=&q="
for { set index 0 } { $index<[llength $arg] } { incr index } {
set query "$query[lindex $arg $index]"
if {$index<[llength $arg]-1} then {
set query "$query+"
}
}
append query &imgsafe=off
# putserv "PRIVMSG $channel :$query"
set token [http::config -useragent $agent]
set token [http::geturl $query]
puts stderr ""
upvar #0 $token state
set max 0
foreach {name value} $state(meta) {
if {[regexp -nocase ^location$ $name]} {
set starturl "http://"
set newurl [string trim $value]
set newurl [string range $newurl [expr [string first = $newurl]+1] [expr [string first & $newurl]-1]]
append starturl $newurl
putserv "PRIVMSG $channel :$starturl"
}
}
}
}

proc pub:file { nick uhost handle channel arg } {
global agent
if {[llength $arg]==0} {
putserv "PRIVMSG $channel :hey ! tappes un nom de fichier boulet !"
} else {
set query "http://www.filemirrors.com/find.src?file="
set query "$query[lindex $arg 0]"
# putserv "PRIVMSG $channel :$query"
set token [http::config -useragent $agent]
set token [http::geturl $query]
set html [http::data $token]
puts stderr ""
upvar #0 $token state
set max 0
# foreach {name value} $state(meta) {
# putserv "PRIVMSG $channel :$value"
# }
# putserv "PRIVMSG $channel :$html"
set result "[lindex $html 1]"
set result [string range $result [expr [string first = $result]+2] [expr [string first > $result]-2]]
putserv "PRIVMSG $channel :$result"
}
}

putlog "Google v0.2.1 - LOADED!"
Thats the code :)
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

AxS wrote:Maybe someone could explain what to change so that i can get 5 returns on a search instead of one? I can display the tcl code here if needed. Still doesnt help that the !file trigger is broken :(
Getting multiple results would require a total rewrite of the google proc, becuase it's currently using the "I feel lucky" option which provides an easy way to obtain the url of the first hit. (no need to parse any markup language bullshit)
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

Post by AxS »

Hehe...ok well lets forget 5 returns on a trigger, but how bout any ideas on fixing the 3rd proc !file? I tried changing something simple I changed,

set query "http://www.filemirrors.com/find.src?file="

to

set query "http://www.filemirrors.com/search.src?file="

but all that did was give me a tcl error (obviously i dont know what i'm doing :P)

Tcl error [pub:file]: list element in quotes followed by ">Top" instead
of space

Any ideas?
User avatar
AxS
Halfop
Posts: 46
Joined: Wed Apr 09, 2003 11:57 am

Still no luck!!!

Post by AxS »

Anyone got any ideas please? I'm no good at tcl nor parsing... need an expert out there to fix the script as the !file trigger doesn't work at all.
c
ceepee
Voice
Posts: 7
Joined: Tue Dec 07, 2004 7:51 pm

Post by ceepee »

Hi

I'm using that exact tcl ... earlier today it worked fine ... then i tried adding some extra tcls to the bot ... didn't work so i removed them again and now I keep getting this error:

Code: Select all

Tcl error [pub:google]: error writing "stderr": bad file number
I tried adding egghttp.tcl but that doesn't do the trick ... I can't find anything that has changed since this morning (when it still worked) :o

Anyone else running this? Maybe (really unlikely) google changed something today?

/EDIT: OK, I delved a little deeper and found an answer to the problem here:
http://forum.egghelp.org/viewtopic.php?t=4555
Still don't understand though why it worked this morning ... and then suddenly it didn't work anymore :)
Locked