egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Real
Voice


Joined: 08 Mar 2004
Posts: 24

PostPosted: Mon May 07, 2007 4:01 pm    Post subject: [google.tcl] !image doesn't work anymore? Reply with quote

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:
# 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. Smile
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue May 08, 2007 1:37 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
sjok
Voice


Joined: 13 May 2007
Posts: 1

PostPosted: Sun May 13, 2007 12:05 pm    Post subject: Reply with quote

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 Evil
Back to top
View user's profile Send private message
Real
Voice


Joined: 08 Mar 2004
Posts: 24

PostPosted: Mon May 14, 2007 4:30 pm    Post subject: Reply with quote

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

Does anyone have a clue what might be the problem?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Mon May 14, 2007 9:07 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
indro
Voice


Joined: 29 May 2007
Posts: 4

PostPosted: Tue May 29, 2007 7:12 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
Real
Voice


Joined: 08 Mar 2004
Posts: 24

PostPosted: Mon Jun 18, 2007 1:41 pm    Post subject: Reply with quote

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

No one has a decent solution for this? Sad
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Jun 18, 2007 9:26 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
indro
Voice


Joined: 29 May 2007
Posts: 4

PostPosted: Wed Jun 20, 2007 7:05 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Jun 20, 2007 7:55 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
indro
Voice


Joined: 29 May 2007
Posts: 4

PostPosted: Wed Jun 20, 2007 10:29 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Jun 20, 2007 3:58 pm    Post subject: Reply with quote

What you did wrong was change encodings or something, because...
Code:
    # 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.
Back to top
View user's profile Send private message
indro
Voice


Joined: 29 May 2007
Posts: 4

PostPosted: Wed Jun 20, 2007 6:11 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber