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 

CT-Google.tcl

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


Joined: 22 Feb 2020
Posts: 385

PostPosted: Sun Mar 28, 2021 9:33 pm    Post subject: CT-Google.tcl Reply with quote

So i thought it would be better to start a fresh post about CT-Google.tcl since it currently seems to be one of the only working google scripts.

Download


---------------------------------------------------
Requirements

A Standard Google Account
Custom search API Key
Engine ID
---------------------------------------------------

---------------------------------------------------
Start of Setup Guide

(1): https://developers.google.com/custom-search/v1/overview

(2): Scroll down and Click "Get a key".

(3): Copy your New API Key.

( ): API Key gained.
---------------------------------------------------

(1): https://cse.google.com/cse/create/new

(2): Enter in Sites to search *.google.com

(3): Click Create.

(4): from the right of Modify your search engine Click Control Panel.

(5): Scroll down and click Copy to clipboard

(6): Scroll down to Search the entire web and turn it On

( ): Engine ID Gained
---------------------------------------------------
End of Setup Guide

Then simply copy and paste both the API and ID into the correct places on the Script Wink


Any suggestions and bug reports are more than welcome Razz
_________________
ComputerTech


Last edited by ComputerTech on Mon Apr 05, 2021 2:08 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Goga
Halfop


Joined: 19 Sep 2020
Posts: 50

PostPosted: Mon Apr 05, 2021 5:28 am    Post subject: !Google Reply with quote

Today I received this Error while i do !Google something
Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Mon Apr 05, 2021 2:06 pm    Post subject: Reply with quote

Offtopic: better to keep any new posts about CT-Google here, and not in
http://forum.egghelp.org/viewtopic.php?t=20942&start=30


Ontopic: have you used over 100 searches within 24 hours? as the limit is 100 daily. Razz


Tested working code:
Code:

######################################################################################
# CT-Google.tcl
######################################################################################
#Author    ComputerTech
#IRC       Irc.DareNet.Org  #ComputerTech
#Email     ComputerTech@DareNet.Org
#GitHub    https://github.com/computertech312
#Version   0.3
#Released  21/03/2021
######################################################################################
# Description:
#
#               - An Elaborate Google Search Script.
#               - After 100 usages of the script, it will automatically stop until the next day.
#               - Grab your own API key from here
#                 https://developers.google.com/custom-search/v1/overview
#               - And a Engine ID from here
#                 https://cse.google.com/cse/
#
# Credits:
#
#               - Special thanks to launchd, spyda and CrazyCat.
#
# History:
#
#               - 0.3: Added Max results option.
#               - 0.2: Fixed a few minor bugs.
#               - 0.1: First release.
#
######################################################################################
# Start Of Configuration #
##########################
# Set trigger of the script.
##
set ctgg(trig) "!google"


###################
# Set flag for Commands.
##
# Owner     = n
# Master    = m
# Op        = o
# Voice     = v
# Friend    = f
# Everyone  = -
##
set ctgg(flag) "-"


###################
# Set API Key
##
set ctgg(api) "Your-API-Key"


##################
# Set Engine ID
##
set ctgg(id) "Your-Engine-ID"


##################
# Set to use Notice Or Privmsg for Output of Commands
##
# 0 = Notice
# 1 = Privmsg
# 2 = Channel
##
set ctgg(msg) "2"


##################
# Set amount of results to output
##
set ctgg(max) "3"


########################
# End Of Configuration #
######################################################################################

bind PUB $ctgg(flag) $ctgg(trig) goo:gle

package require json
package require tls
package require http

proc goo:gle {nick host hand chan text} {
   global ctgg google
   set ::google "\00302G\00304o\00308o\00302g\00303l\00304e\003"
   http::register https 443 [list ::tls::socket]
   set url "https://www.googleapis.com/customsearch/v1?key=$ctgg(api)&cx=$ctgg(id)&q=[join $text +]"
   set data "[http::data [http::geturl "$url" -timeout 10000]]"
    http::cleanup $data
   set datadict [::json::json2dict $data]
   set items2 [dict get $datadict "searchInformation"]
          switch -- $ctgg(msg) {
         "0" {set ctgg(output) "NOTICE $nick "}
         "1" {set ctgg(output) "PRIVMSG $nick"}
         "2" {set ctgg(output) "PRIVMSG $chan"}
      }
    set time [dict get $items2 "formattedSearchTime"]
    set total [dict get $items2 "formattedTotalResults"]
    putserv "$ctgg(output) :$google  About $total results ($time seconds)"
    set items [dict get $datadict "items"]
   for {set i 0} {$i < $ctgg(max)} {incr i} {
      set item [lindex $items $i]
      set title [dict get $item "title"]
      set link [dict get $item "link"]
      set info [dict get $item "snippet"]
      putserv "$ctgg(output) : $title / $link / $info"
   }
      http::unregister https
}
putlog "$::google.tcl v0.3 by ComputerTech Loaded"
######################################################################################

_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Goga
Halfop


Joined: 19 Sep 2020
Posts: 50

PostPosted: Mon Sep 27, 2021 3:13 am    Post subject: Reply with quote

Error Is :
Code:
Tcl error [goo:gle]: unsupported url type "https"
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Wed Sep 29, 2021 4:01 pm    Post subject: Reply with quote

I'll try look at it in a bit to see what the problem is Wink
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Tue Oct 05, 2021 11:49 pm    Post subject: Reply with quote

Goga, i do not see the problem you are facing.
Code:

20<ComputerTech>30 !google eggdrop github
18<CX18> 02G04o08o02g03l04e  About 35,600 results (0.43 seconds)
18<CX18>  eggheads/eggdrop: The Eggdrop IRC Bot - GitHub / https://github.com/eggheads/eggdrop / May 5, 2021 ... The Eggdrop IRC Bot. Contribute to eggheads/eggdrop development by creating an account on GitHub.
18<CX18>  Eggheads / https://www.eggheads.org/ / Eggdrop is the oldest Internet Relay Chat (IRC) bot still in active development. Originally created by Robey Pointer in December 1993 for use on a channel ...
18<CX18>  eggheads/eggdrop-docker - GitHub / https://github.com/eggheads/eggdrop-docker / eggdrop-docker. This is the Git repo for the official Docker image of Eggdrop, the Internet's oldest IRC bot still under active development.

Perhaps your Engine ID or API is invalid?
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Goga
Halfop


Joined: 19 Sep 2020
Posts: 50

PostPosted: Wed Oct 06, 2021 12:26 am    Post subject: Reply with quote

Can you give me hint what could be the Problem is ? I am getting these two ERRORs.
Code:
Tcl error [goo:gle]: key "items" not known in dictionary
 Tcl error [goo:gle]: key "items" not known in dictionary
 Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
 Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587

Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Wed Oct 06, 2021 11:17 am    Post subject: Reply with quote

The only possible cause is a invalid Engine ID or API key, try getting another Engine ID.
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Wed Oct 06, 2021 5:54 pm    Post subject: Reply with quote

If you're confused on how to create a new Engine ID, use this one
Code:

ddd815d6eed4ec2ff

Smile
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Goga
Halfop


Joined: 19 Sep 2020
Posts: 50

PostPosted: Thu Oct 07, 2021 1:28 am    Post subject: Reply with quote

Code:
[05:21:59] Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
[05:23:14] Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
[05:23:24] Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
[05:23:40] Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
[05:24:18] Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
[05:28:18] Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 385

PostPosted: Thu Oct 07, 2021 7:49 am    Post subject: Reply with quote

Obviously the problem is on your side and not the script, as it works perfectly for me, have you tried the suggestions I suggested? or i don't know maybe .restart your bot?
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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