View previous topic :: View next topic |
Author |
Message |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Sun Mar 28, 2021 9:33 pm Post subject: CT-Google.tcl |
|
|
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
Any suggestions and bug reports are more than welcome  _________________ ComputerTech
Last edited by ComputerTech on Mon Apr 05, 2021 2:08 pm; edited 1 time in total |
|
Back to top |
|
 |
Goga Halfop
Joined: 19 Sep 2020 Posts: 78
|
Posted: Mon Apr 05, 2021 5:28 am Post subject: !Google |
|
|
Today I received this Error while i do !Google something
Tcl error [goo:gle]: error reading "sock10": Unknown error: 50327587 |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Mon Apr 05, 2021 2:06 pm Post subject: |
|
|
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.
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 |
|
 |
Goga Halfop
Joined: 19 Sep 2020 Posts: 78
|
Posted: Mon Sep 27, 2021 3:13 am Post subject: |
|
|
Error Is :
Code: | Tcl error [goo:gle]: unsupported url type "https" |
|
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Wed Sep 29, 2021 4:01 pm Post subject: |
|
|
I'll try look at it in a bit to see what the problem is  _________________ ComputerTech |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Tue Oct 05, 2021 11:49 pm Post subject: |
|
|
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 |
|
 |
Goga Halfop
Joined: 19 Sep 2020 Posts: 78
|
Posted: Wed Oct 06, 2021 12:26 am Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Wed Oct 06, 2021 11:17 am Post subject: |
|
|
The only possible cause is a invalid Engine ID or API key, try getting another Engine ID. _________________ ComputerTech |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Wed Oct 06, 2021 5:54 pm Post subject: |
|
|
If you're confused on how to create a new Engine ID, use this one
 _________________ ComputerTech |
|
Back to top |
|
 |
Goga Halfop
Joined: 19 Sep 2020 Posts: 78
|
Posted: Thu Oct 07, 2021 1:28 am Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Thu Oct 07, 2021 7:49 am Post subject: |
|
|
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 |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 46 Location: United Kingdom
|
Posted: Wed Feb 09, 2022 2:45 pm Post subject: |
|
|
I have the script spitting out the following error.
Tcl error [goo:gle]: unsupported url type "https" |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Wed Feb 09, 2022 2:55 pm Post subject: |
|
|
Dominatez wrote: | I have the script spitting out the following error.
Tcl error [goo:gle]: unsupported url type "https" |
Do you have the tls package installed/loaded on your bot/server?
Code: |
.tcl package require tls
|
Should return what version of tls you have. _________________ ComputerTech |
|
Back to top |
|
 |
Dominatez Halfop

Joined: 14 Jan 2019 Posts: 46 Location: United Kingdom
|
Posted: Wed Feb 09, 2022 3:30 pm Post subject: |
|
|
Yes i do.
I have Tcl: 1.7.20 installed
I changed the
set ctgg(max) "5"
To 5
It has started spitting the error out when i changed it to that. |
|
Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 394
|
Posted: Wed Feb 09, 2022 3:39 pm Post subject: |
|
|
Not sure what the problem is on your end, as when i set the max variable to 5 and here's the results.
Code: |
<ComputerTech> !google lego
<Eggdrop> Google About 5,760,000,000 results (0.50 seconds)
<Eggdrop> Home | Official LEGO® Shop US / https://www.lego.com/en-us / Explore the world of LEGO® through games, videos, products and more! Shop awesome LEGO® building toys and brick sets and find the perfect gift for your kid.
<Eggdrop> LEGO IDEAS - Home / https://ideas.lego.com/ / Skip to main content. LEGO IDEAS Logo. Explore. Blog. How It Works. Me. Log In. Log in Create account. LEGO IDEAS Logo.
<Eggdrop> Themes | Official LEGO® Shop US / https://www.lego.com/en-us/themes / Develop children's creativity with LEGO® Classic. Sets contain ideas to help them get started, while special pieces alongside classic LEGO bricks inspire even ...
<Eggdrop> LEGO® Education: Classroom Solutions for STEM and STEAM / https://education.lego.com/ / LEGO® Education solutions teach children 21st century skills for future success, starting with preschool and moving through elementary, middle and high ...
<Eggdrop> Sonic the Hedgehog™ – Green Hill Zone 21331 | Ideas - LEGO / https://www.lego.com/en-us/product/sonic-the-hedgehog-green-hill-zone-21331 / Get in the brick-built zone of an iconic 1990s game.
|
And here is the package versions.
Code: |
<ComputerTech> .tcl package require tls
<Eggdrop> Tcl: 1.7.20
<ComputerTech> .tcl package require http
<Eggdrop> Tcl: 2.9.1
<ComputerTech> .tcl package require json
<Eggdrop> Tcl: 1.3.4
|
Can you show me your package versions perhaps? _________________ ComputerTech |
|
Back to top |
|
 |
|