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] !image doesn't work anymore?

Support & discussion of released scripts, and announcements of new releases.
Post Reply
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

[google.tcl] !image doesn't work anymore?

Post by Real »

Howdy. I have a problem with my google.tcl script. For some reason my !image command doesn't do anything anymore. I suspect this has something to do with Google changing something to their website, perhaps?

My bot doesn't return any errors when using the !image command. I've tried disabling all other scripts, but nothing helps.

I'm pretty sure I didn't change anything to my eggdrop configuration or scripts whatsoever.

!google still works fine.

Code: Select all

# google.tcl v0.2.2
#
# !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 analogue - analogue@glop.org - http://www.glop.org/

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 "\0033google.tcl By aNa|0Gue Loaded"
Anyone else with the same problem maybe?

Thanks a bunch. :)
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

by analogue - analogue@glop.org - http://www.glop.org/

His site is up and running, so I would assume he's still at that email address and still supporting his scripts. Contact the author.
s
sjok
Voice
Posts: 1
Joined: Sun May 13, 2007 12:01 pm

Post by sjok »

I have the exact same problem, one day it just stopped working. The google function still works but the image function just died. anyhow i hope someone will fix it, we need some image abuse back in our channel :twisted:
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

Post by Real »

I emailed him, but unfortunately no response (yet).

Does anyone have a clue what might be the problem?
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Most likely website changed.. If the author of that script doesn't want to support it, there's always the google script from Incith and Madwoota, who are both active on this forum and actively developing their google script.
i
indro
Voice
Posts: 4
Joined: Tue May 29, 2007 6:56 am

Post by indro »

rosc2112 wrote:Most likely website changed.. If the author of that script doesn't want to support it, there's always the google script from Incith and Madwoota, who are both active on this forum and actively developing their google script.
Incith and Madwoota scripts are nice, but I love this script because it simpel.

I think, google changed his path or smth - maybe somebody can fix this script, thank you!
R
Real
Voice
Posts: 24
Joined: Mon Mar 08, 2004 11:27 am

Post by Real »

There's still no fix for this. Other scripts seem to be too complicated for me.

No one has a decent solution for this? :(
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Search the Tcl Archive for incith:google. It's not complicated to setup, and it works!
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
i
indro
Voice
Posts: 4
Joined: Tue May 29, 2007 6:56 am

Post by indro »

Alchera wrote:Search the Tcl Archive for incith:google. It's not complicated to setup, and it works!
Problem is not that incith script are complicate, I example dont like it because this gives 3 answers but I want only one:(
I`m pretty sure that here are people who can fix this script, maybe somone will do this?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

indro wrote:
Alchera wrote:Search the Tcl Archive for incith:google. It's not complicated to setup, and it works!
Problem is not that incith script are complicate, I example dont like it because this gives 3 answers but I want only one:(
I`m pretty sure that here are people who can fix this script, maybe somone will do this?
'Config section of incith google' wrote: # number of search results/image links to return, 'define:' is always 1 as some defs are huge
variable search_results 4
variable image_results 4
variable local_results 4
... etc etc, continues ...
I can easily see a way to make incith-google give 1 result, sure you can too if you only read the config.

And now, about this script and why image no longer works. It's because of how this script isn't parsing the sites actual html at all, and rather using http packages state (meta array) function. For google images, I believe location tag does not exist in the meta array any longer, which is what it needs to function. It also has no fallback to catch if location isn't found to at least tell users 'No results found'. So your left wondering is it working? Why is it just doing nothing!!? A check of .set errorInfo won't tell you a thing because there was no error.

To get information from google images nowadays you have to actually get your code dirty (read as: more complicated) to parse the body of the html, such as incith's google script does. This is why you are being told to use it instead, and most importantly, why no one has offered up any script fixes.
i
indro
Voice
Posts: 4
Joined: Tue May 29, 2007 6:56 am

Post by indro »

speechles wrote: Config section of incith google - # number of search results/image links to return, 'define:' is always 1 as some defs are huge
variable search_results 4
variable image_results 4
variable local_results 4
... etc etc, continues ...

I can easily see a way to make incith-google give 1 result, sure you can too if you only read the config.
I changed variable search_results 1 and error is above:

[16:58] Tcl error in file 'eggdrop.conf':
[16:58] syntax error in expression "$incith::google::ignore 1": extra tokens at
end of expression
("if" test expression)
while compiling
"if {$incith::google::ignore 1} {
return 0
}"
(compiling body of proc "flood_init", line 2)
invoked from within
"flood_init"
(in namespace eval "::incith::google" script line 1138)
invoked from within
"namespace eval google {
# GOOGLE
# performs a search on google.
#
proc google {input} {
# local variable initialization
se..."
(in namespace eval "::incith" script line 2)
invoked from within
"namespace eval incith {
namespace eval google {
# GOOGLE
# performs a search on google.
#
proc google {input} {
# local variab..."

[16:58] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

What I do wrong?
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

What you did wrong was change encodings or something, because...

Code: Select all

    # FLOOD_INIT
    # modified from bseen
    #
    variable flood_data
    variable flood_array
    proc flood_init {} {
      if {$incith::google::ignore < 1} {
        return 0
      }
I can clearly see a less than sign here in my copy where your copy is missing this evaluator. Under certain language encodings this might happen. If your using windows notepad, that is your problem, edit with wordpad instead.
i
indro
Voice
Posts: 4
Joined: Tue May 29, 2007 6:56 am

Post by indro »

speechles wrote:If your using windows notepad, that is your problem, edit with wordpad instead.
I use always Macromedia Dreamweaver for this kind editing, not a notepad. Now I did this with wordpad and everything works fine. Thank You Speechles!, now I will use Incith script.
Post Reply