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.

YoutubeTitle V2 - Version 2.1 (22/08/16)

Support & discussion of released scripts, and announcements of new releases.
V
Viper
Voice
Posts: 3
Joined: Fri Aug 29, 2014 4:59 am

YoutubeTitle V2 - Version 2.1 (22/08/16)

Post by Viper »

I've released a new version, the release post can be found here, but the download links at the botton of this post have also been updated.

Original post (with edits to remove outdated instructions):
Recently I was looking for a simple youtube script, but of all the ones I found, I didn't really like any.. either they were too basic, not reliable or I just didn't like the code or how they got their data.. (ewww @ regex based parsers..)
So I took the simple script YoutubeTitle (the only JSON based one I had seen; regexes == maintenance nightmare) and thought I'd make some changes, add some more data fields and be done with it.. ended up doing a bit more. The final result is about 90% new code, so it's closer to an entirely new script then an update but oh well.. :roll:

I mostly wrote this thing for myself, but figured I'd post it here in case someone else has a use for it..

Note that this is actually my first eggdrop script AND even my first try at writing anything in TCL so.. it might still have some minor issues. While I'm new to the language (TCL), I am not new to programming, so don't worry, it shouldn't cause explosions.. :roll:
There's a couple more things I'd like to do at some point, mostly code improvements like putting everything in a namespace, but it works right now and I'll see about the rest later..

Highlights of this script:
* Use the YouTube Data API V3. (Requires TLS support!)
* Strip out flat_json_decoder and use json & dict packages instead.
* Many more data elements supported in response format (possible by new API).
* Added possiblity to turn the script on/off on a channel by channel basis.
* Added ability to search youtube and return the first result.
* Added support for YouTube searches returning multiple search results. (New in 2.1)
* Added basic anti-flood measures by implementing a minimum interval between searches. (New in 2.1)
The script should be self explanatory, but there are 3 items worth noting:
1 - it requires TCL 8.5 and the http, json & tls packages to be installed.
2 - it uses the most recent version of the google API for accessing youtube data..
3 - there could be a conflict with other scripts that use TLS (eg: incith-google). These scripts create a handler for HTTPS - as does mine - but most don't seem to bother setting the source IP address to the my-ip setting from eggdrop.conf. Since the google API key can be linked to an IP, this may cause authentication issues.. the best solution is to ensure this script is loaded last so it will overwrite the HTTPS handler created by scripts loaded before it.

GIT repository: http://git.milanza.org/?p=eggdrop-scripts/YoutubeTitle
Direct download of 2.1 here
:D
Last edited by Viper on Mon Aug 22, 2016 3:00 pm, edited 1 time in total.
g
gamefan098
Voice
Posts: 8
Joined: Thu May 19, 2016 8:56 am

Post by gamefan098 »

can you tell me from where can i download

package require Tcl 8.5
package require http 2.7
package require tls
package require json
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

gamefan098 wrote:can you tell me from where can i download

package require Tcl 8.5
package require http 2.7
package require tls
package require json
Use whatever package manager you have, yum, apt, synaptic, etc.

For apt *drop sudo if you are in root*;
sudo apt-get install tcl tcl8.5 tcl8.5-dev tcllib tcl-tls
The json, http packages are included in tcllib while the tls package is separate.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
g
gamefan098
Voice
Posts: 8
Joined: Thu May 19, 2016 8:56 am

Post by gamefan098 »

the bad thing is that im using windows ( windrop ) not eggdrop :/ So is it there another way to get those scripts ?
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

gamefan098 wrote:the bad thing is that im using windows ( windrop ) not eggdrop :/ So is it there another way to get those scripts ?
how unfortunate. Have you looked at maybe installing a dualboot on your system, so linux is installed, or how about a VPS (Virtual Private Server) as there are many good and cheap providers out there all fighting for more business.

If you're unable to do either of the above, then download from ActiveTCL here. As it has been a LONG LONG time since I've used windrop, and as this is an eggdrop support forum, I'm unsure how much support you'll find here and I am also unsure if the ActiveTCL comes with the packages you require; tcllib and tcl-tls. You may want to consult google in this regard.
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Grab latest versions of tls.tcl and json.tcl and load them before your script and see if this helps.

The http package should be in TCL.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

hi to all, hi caesar
and download tls.tcl and json.tcl
only add in:
source scripts/tls.tcl
source scripts/json.tcl
is correct or not friends
and and where I download http.tcl 2.7.. thanks
Last edited by Arnold_X-P on Wed May 25, 2016 10:34 am, edited 1 time in total.
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Yes, give that a try. If you get an error about missing http 2.7 package move the package require http 2.7 line after package require json and see if the tls and json work.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

caesar ---
and and where I download http.tcl 2.7.. thanks
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Get_A_Fix
Master
Posts: 206
Joined: Sat May 07, 2005 6:11 pm
Location: New Zealand

Post by Get_A_Fix »

Arnold_X-P wrote:caesar ---
and and where I download http.tcl 2.7.. thanks
If you're using eggdrop, refer to my previous post re; installing tcl tcllib tcl-tls - json and http packages are included, you'd only require http.tcl if you were running windrop (with VPS deals being so cheap these days anyone can run the real m'coy).

Otherwise, a simple google search for "eggdrop http 2.7" returned this script
We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Current version of Windrop from here comes with the http.tcl file version 1.0 and you will find it in lib/tcl8.5/http1.0 and apparently the same version 2.7 file Get_A_Fix mentioned can be found in lib/tcl8/8.4 and is called http-2.7.7.tm
Once the game is over, the king and the pawn go back in the same box.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

I downloaded http v2.7.12.tcl running smoothly
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
g
gamefan098
Voice
Posts: 8
Joined: Thu May 19, 2016 8:56 am

Post by gamefan098 »

gamefan098 wrote:So i find http tcl and i download tls and json tcl from links in this post:
caesar wrote:Grab latest versions of tls.tcl and json.tcl and load them before your script and see if this helps.

The http package should be in TCL.
but when i run my bot i tell that i haver error
[15:31:51] TLS - Loaded.
[15:31:51] Json Tcl - Loaded.
[15:31:51] Tcl error in file 'eggdrop.conf':
[15:31:51] can't find package tls
while executing
"package require tls"
(file "scripts/ytt.tcl" line 175)
invoked from within
"source scripts/ytt.tcl"
(file "eggdrop.conf" line 1429)
[15:31:51] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
This is my eggdrop.conf
source scripts/tls.tcl
source scripts/json.tcl
source scripts/http-2.7.5.tcl
source scripts/ytt.tcl

i write a line in tls an json to tell me that they are loaded so i cnow that TLS is ok but why my youtube.tcl didnt respond ?
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

In that case get this then extract the files to your windrop\lib\tclX folder, where X is the version number of the tcl package. In my case i put the extracted folder tls1.6 in lib\tcl8.5 cos have an old version.

And it's working:
.tcl package require tls
Tcl: 1.6
Also, would be great if the author could change:

Code: Select all

package require Tcl 8.5
package require http 2.7
package require tls
package require json
with something like:

Code: Select all

set stop 0
foreach ele [list "Tcl 8.5" "http 2.7" "tls" "json"] {
	if {[catch {package require $ele} err]} {
		putlog "Error loading package '$ele' : $err"
		incr stop
	}
}

if {$stop} return
so the bot won't die if one of the packages is missing. Just saying. ;)
Once the game is over, the king and the pawn go back in the same box.
g
gamefan098
Voice
Posts: 8
Joined: Thu May 19, 2016 8:56 am

Re: YoutubeTitle V2

Post by gamefan098 »

Thanx all to all ! @caesar i add tls in my scripts folder before i read your post ... it helps allot!
Post Reply