Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Advanced Google Eggdrop Script

Recommended Posts

  • Administrators

Description:

 

This is a tcl script for eggdrop. Not for mIRC!

Loading:

 

 

 

•Save this code to a file called AdvancedGoogle.tcl

 

•Place the file in your eggdrop scripts directory

 

•Add this line to eggdrop.conf -->> source scripts/AdvancedGoogle.tcl

 

•Rehash or restart your eggdrop

 

•(In the console) type .chanset #channelname +google "where #channelname is the channel you want the script on in"

 

Triggers:

 

 

 

•!google search words (general searches)

 

•!glocal search words (returns results related to a local area search)

 

•!gvideo search words (returns video results)

 

•!gnews search words (returns news results related you your search words)

 

•!gbook search words (returns book results)

 

•!gimage search words (returns image/picture results)

 

•!gpatent search words (does a search of registered patents)

 

Example Output:

21:02:04 !google eggdrop

21:02:06 google Eggheads.org - Main Index http://www.eggheads.org/

21:02:07 google Eggheads.org - Downloads http://www.eggheads.org/downloads/

21:02:07 google slennox''s eggdrop page http://www.egghelp.org/

 

 

 

 


##############################################################################################

##  ## Advanced Google.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help  ##  ##

##############################################################################################

##  ## To use this script you must set channel flag +google (ie .chanset #chan +google) ##  ##

##############################################################################################

##############################################################################################

##  ##                             Start Setup.                                         ##  ##

##############################################################################################

## Change the character between the "" below to change the command character/trigger.       ##

set googlecmdchar "!"

proc google {nick host hand chan type search} {

  if {[lsearch -exact [channel info $chan] +google] != -1} {

## Change the country code between the "" below to change the language of your results.     ##

    set googlectry "en"

## Change the number between the "" below to change the number of results returned.         ##

    set googlemax "3"

## Change the characters between the "" below to change the logo shown with each result.    ##

    set googlelogo "\002\0032g\0034o\0038o\00314g\0039l\0034e\002\003"

## Change the format codes between the "" below to change the color/state of the text.      ##

    set textf "\0034"

## Change the format codes between the "" below to change the color/state of the links.     ##

    set linkf "\003\037"

##############################################################################################

##  ##                           End Setup.                                              ## ##

##############################################################################################

    set googlesite ajax.googleapis.com

    set googleurl /ajax/services/search/${type}?v=1.0&rsz=large&q=${search}&ql=${googlectry}&lr=lang_${googlectry}

    if {[catch {set googlesock [socket -async $googlesite 80]} sockerr]} {

      putlog "$googlesite $googleurl $sockerr error"

      return 0

      } else {

      puts $googlesock "GET $googleurl HTTP/1.0"

      puts $googlesock "Host: $googlesite"

      puts $googlesock "User-Agent: Opera 9.6"

      puts $googlesock ""

      flush $googlesock

      while {![eof $googlesock]} {

        set googlevar " [gets $googlesock] "

        set googlelink [regexp -all -nocase -inline {\"url\":\"([^\"]*)\"} $googlevar]

        set googledesc [regexp -all -nocase -inline {\"title\":\"([^\"]*)\"} $googlevar]

        if {$googledesc != "" && $googlelink != ""} {

          for {set x 1} {$x 

Link to comment
Share on other sites



×
×
  • Create New...