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.

incith:google :)

Support & discussion of released scripts, and announcements of new releases.
Post Reply
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

incith:google :)

Post by incith »

Newest versions of my scripts are always available @ incith.com if they are not yet available on the Tcl archive.

I just wanted to create a thread about my Google script, incith:google.

In its most recent submission, it can of course do regular Google searches. It can also display the results in different languages! (italian, danish, german, spanish & french work well).

Edit: Thought I'd mention these: You can make the results be displayed on a seperate line each. Set the seperator to "\n". Also, you'll have to .chanset #channel +google to enable the script.

You could also (!g is our google trigger):

Code: Select all

!g 4+4
!g (4*3)^5+sqrt(6)
!g [convert] 1 foot to inches
!g 1 canadian dollar in american dollars (1 cad in usd, my Yahoo! :exchange script gives different results, however)
!g patent ### (returns link to US patent db or someish)
!g define: word
!g spell: word (will return "Did You Mean?" matches, if one exists, so it's not a complete spell checker, but it sure helps generally).
..and soon I'll parse "movie: <search>" movie reviews. :-)

You also have !image support, and recently !local support!

Local.google.com is quite neat. :) So you can go !local pizza near <your location> and get some restaurants.

The script comes with flood protection & private messages support, and I've changed how it displays links so that you should no longer have problems clicking on links.

Finally, I've investigated video.google.com (it's beta, you might not know about it *wink*), but it requires the Google video player, and nowhere in the HTML could I find a link to the actual movie itself, so it would seem it's impossible to return links to movies. :-(

Regards,
Jordan.
Last edited by incith on Sat Feb 02, 2008 11:33 pm, edited 1 time in total.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

where is it?
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

demond wrote:where is it?
.. err, why, on the Egghelp Tcl Archive of course! :roll:
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

hmm, it's somehow corrupted, and you have gzipped http-2.5.tcl as incith-google.tcl (btw why did you include that http package source? it's already provided by Tcl distribution)
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

Edit: slennox has updated the database with the fixed copy. You can obtain it there.
Alright, well, here's a fixed copy: Recent Tcl Submissions @ Egghelp.

And, yeah.. the http-2.5.tcl is only for Windrop users, in which case it should be sourced *before* google or any other script really, as it will provide the http package that many scripts crave. :-)

Code: Select all

source scripts/http-2.5.tcl
source scripts/incith-google.tcl
Cheers! Thanks for pointing out the corruptedness.
m
madwoota
Halfop
Posts: 53
Joined: Tue Aug 09, 2005 12:27 am

Post by madwoota »

incith, there seems to be a bug in the parsing of some results for local searches.

eg:
"!gl pizza hut near seattle" works
"!gl pizza hut near ottowa" works
"!gl pizza hut near calgary" returns a whole bunch of raw html

it seems to do that when it gets an " - Unverified listing" next to the name of the search result.
eg: an extra <font size=-1> - <nobr>Unverified listing</nobr></font> in the html code.

using 1.4 ... default settings ... eggdrop 1.6.17, linux 2.6.10, tcl 8.4.9 no http package, etc, etc, etc.
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

Confirmed!

I'll try and fix this soon.. and thanks for reporting! It definitely helps.

I'm in Edmonton, by the way. ;-)

Edit:
This should fix it, for now.. in proc fetch_html, find the second elseif {$switch == 3}, near the bottom, before return $html and add a new regsub, so it'll look like this:

Code: Select all

      } elseif {$switch == 3} {
        # begin modifications, add this regsub:
        regsub -all -nocase { - <nobr>Unverified listing</nobr>} $html "" html
        # end modifications
        regsub -all -nocase {(?:<b>|</b>)} $html "" html
      }
      return $html
Regards~
m
madwoota
Halfop
Posts: 53
Joined: Tue Aug 09, 2005 12:27 am

Post by madwoota »

Thanks incith, confirmed working :D
m
madwoota
Halfop
Posts: 53
Joined: Tue Aug 09, 2005 12:27 am

Post by madwoota »

Ok, now thats out of the way, time for some begging/suggestions/thoughts/feedback :)

General suggestions, feel free to ignore them all as if you listen to us damn (ab)users too much, it ends up taking over your life! (And then we whinge & complain when all the free support vanishes and stuff... *cough*)

1 - Include ability to specify language per search instead of only having the default eg: "!g -fr blahblah"

2 - Also part of 1 - allow users to create a default setting for themselves ... perhaps register it in their bot handles, eg: "--XTRA incithgoogle.lang" or something.

3 - It'd be nice to be able to hard code the "allowed" or even "ignored" channels into the tcl/settings file too. While I think the +google setting is fantastic for dynamic channels, it creates a problem when you use a "source channels/settings" file to define the channels layouts in that eggdrop will crash if you define the channels prior to running this script.
(It complains about +google being an invalid channel setting.)

4 - Similar to 1 & 2 above, allow to use the "local" google for searching. Eg: www.google.com.au for me. Its a bit faster and stuff. Would be a lot better for the non-english language users too.

5 - Along the same lines/purposes of the language & local google ideas - allow domain/site narrowing. eg: "!g -.au blahblah". This often returns different results to just using the narrowing the "country" search to say "au". Would use the "site:.blah" modifier as per the below cheatsheets.

6 - More "!g define:" style extras from here: http://www.google.com/help/operators.html and http://www.google.com/help/cheatsheet.html
Stocks: is one of those I can certainly see myself using :)

PS: If you dont mind these ideas, I'm happy to do some code ideas and send you various bits to add in if you like. Royalty free too !!

PPS: Damn nice addon, it's given me a purpose in life :D
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

madwoota wrote:General suggestions, feel free to ignore them all as if you listen to us damn (ab)users too much, it ends up taking over your life! (And then we whinge & complain when all the free support vanishes and stuff... *cough*)
Nobody ever emails me until it's broken.. =/ Sometimes I wonder if people are even using it, or if it's just working properly for'm. :-P
madwoota wrote:1 - Include ability to specify language per search instead of only having the default eg: "!g -fr blahblah"
Good idea. I need to clean up my google script somewhat, it's gotten a bit messy. I had thought about flags/modifiers/options to pass before, not with any serious thought mind you, but what if you want to literally "-fr" in the search? "!g -fr -fr" ? So I'll have to think about a sane way to do it, perhaps using long flags (--fr vs. -fr).
madwoota wrote:2 - Also part of 1 - allow users to create a default setting for themselves ... perhaps register it in their bot handles, eg: "--XTRA incithgoogle.lang" or something.
Yeah. I probably never would have thought about this as everyone speaks English in my channel, despite a few are natively french. I'll add it to the todo as well.
madwoota wrote:3 - It'd be nice to be able to hard code the "allowed" or even "ignored" channels into the tcl/settings file too. While I think the +google setting is fantastic for dynamic channels, it creates a problem when you use a "source channels/settings" file to define the channels layouts in that eggdrop will crash if you define the channels prior to running this script.
(It complains about +google being an invalid channel setting.)
Ah, that's a shame ;-) I like the +google-ness. No rehashing to update the channels.. but if it's causing problems, I'll perhaps change my scripts into a 'allow_channels' variable.
madwoota wrote:4 - Similar to 1 & 2 above, allow to use the "local" google for searching. Eg: www.google.com.au for me. Its a bit faster and stuff. Would be a lot better for the non-english language users too.
Faster.. meh. More accurate results? Probably. If I can tie it into the '-fr' options above easily, perhaps. Otherwise this probably won't see light.
madwoota wrote:5 - Along the same lines/purposes of the language & local google ideas - allow domain/site narrowing. eg: "!g -.au blahblah". This often returns different results to just using the narrowing the "country" search to say "au". Would use the "site:.blah" modifier as per the below cheatsheets.
I'll have to look into this a bit.. I understand what you mean, but to me, and after reading the operators and such, "-.au" would (should?) merely just not search for ".au", but I've not even tested this theory. Does it remove .au websites too? Or just search results containing .au in them?
madwoota wrote:6 - More "!g define:" style extras from here: http://www.google.com/help/operators.html and http://www.google.com/help/cheatsheet.html
Stocks: is one of those I can certainly see myself using :)
Hmph. I've of course been all around the google help areas, but never knew about these two pages. This looks fun. ^^ Yeah, I had plans to add stocks. Obviously useful. I had my incith:exchange script, but Google does that too. Among others, I wanted to add the movie: reviews as I mentioned, and UPC codes! Fun stuff.
madwoota wrote:PS: If you dont mind these ideas, I'm happy to do some code ideas and send you various bits to add in if you like. Royalty free too !!
Royalty free! Well, this could be good for me as I'm potentially going to be quite busy in the next few months.. e-mail me sometime if you like. :)
madwoota wrote:PPS: Damn nice addon, it's given me a purpose in life :D
Hehe, thanks. I just wrote it for the lack of (working?) google scripts around, and because.. well, there's a lot more to google than google.com. I also wrote a script for filemirrors.com, which one of those google scripts used to parse .. I'll be releasing that soon, for !file functionality.

Regards~
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

a little bit offtopic, but loading chan settings from a script is bad practice - the chanfile is there for a reason, and the reason is that, besides providing dynamic settings modification, it actually gets loaded after the config (and therefore after all scripts), thus allowing all [setudef]s to take place before reading in their actual values for a particular channel

so, +google chan setting should stay; and in general, no script should require configuring its channel functionality not via .chanset
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

Alright, I'll keep the setudef functionality. It seemed cleaner this way as it is anyway. =)
m
madwoota
Halfop
Posts: 53
Joined: Tue Aug 09, 2005 12:27 am

Post by madwoota »

I wasnt saying to remove that functionality, only *add* the *option* to put it in the tcl/conf file.

It could remain #'d out to ignore it & default to a +google.

And saying you should or shouldnt do something is irrelevant since its dependant entirely on your own personal preference.

I use a setup that works for me, but its also very security concious, and hard codes a lot of variables within the files (eg: static channel definitions).

It used to be more of a problem back when people could more easily spoof hostmasks and join channels and such as a +n.


Anyway, incith, I've added two things already.
1 - Recognition for a "special match" eg: something like this, you will get the first results as a "special match" or whatever google calls it.

2 - groups.google.com search added via !gg !group and !groups :)

If you want either of these, let me know and I'll send you either the whole thing or a .diff.
User avatar
incith
Master
Posts: 275
Joined: Sat Apr 23, 2005 2:16 am
Location: Canada

Post by incith »

Oh, yeah. Google groups was another TODO thing that a friend wanted. =) (but I forgot about it..)

I just submitted incith:xrl (xrl.us url shortening service) and incith:filemirrors (filemirrors.com file searching), and I had to update horoscope for a couple folks that emailed me about it.. so at the moment I'm a bit Tcl'd out =)

I think I may try and clean up google before the next release, that while{} loop has grown monstrously scary..

As far as inline settable channels.. I suppose we could have a [check_channel] proc that would check for the setudef flag and the settable channels variable.

Code: Select all

if {[check_channel $chan] != 1} { return }
If I clean up google.. I want to make it easy to add new '[link:define:]' etc searches, and blah blah.. regsubbing through it is just starting to feel really nasty.

Regards~
m
madwoota
Halfop
Posts: 53
Joined: Tue Aug 09, 2005 12:27 am

Post by madwoota »

incith wrote:If I clean up google.. I want to make it easy to add new '[link:define:]' etc searches, and blah blah.. regsubbing through it is just starting to feel really nasty.
Mate, I just spent a couple hours delving through your stuff ... its not that bad compared to some of the rubbish I've created :)

Also, .diff file emailed with above changes (was easier than commenting everything and sending the whole shebang).

Might have a go at a few more additions too.
Post Reply