| View previous topic :: View next topic |
| Author |
Message |
Viper Voice
Joined: 29 Aug 2014 Posts: 3
|
Posted: Fri Aug 29, 2014 6:43 am Post subject: YoutubeTitle V2 - Version 2.1 (22/08/16) |
|
|
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..
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..
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:
| Quote: | * 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

Last edited by Viper on Mon Aug 22, 2016 3:00 pm; edited 1 time in total |
|
| Back to top |
|
 |
gamefan098 Voice
Joined: 19 May 2016 Posts: 8
|
Posted: Thu May 19, 2016 8:59 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Thu May 19, 2016 7:29 pm Post subject: |
|
|
| 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*;
| Quote: | | 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. |
|
| Back to top |
|
 |
gamefan098 Voice
Joined: 19 May 2016 Posts: 8
|
Posted: Thu May 19, 2016 9:34 pm Post subject: |
|
|
| the bad thing is that im using windows ( windrop ) not eggdrop :/ So is it there another way to get those scripts ? |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Fri May 20, 2016 11:42 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed May 25, 2016 9:42 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed May 25, 2016 10:31 am Post subject: |
|
|
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 _________________
thanks to that they help, that others learn 
Last edited by Arnold_X-P on Wed May 25, 2016 10:34 am; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed May 25, 2016 10:32 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Wed May 25, 2016 10:35 am Post subject: |
|
|
caesar ---
and and where I download http.tcl 2.7.. thanks _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Wed May 25, 2016 7:52 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu May 26, 2016 7:14 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Arnold_X-P Master

Joined: 30 Oct 2006 Posts: 221 Location: DALnet - Trinidad - Beni - Bolivia
|
Posted: Fri May 27, 2016 12:03 am Post subject: |
|
|
I downloaded http v2.7.12.tcl running smoothly _________________
thanks to that they help, that others learn  |
|
| Back to top |
|
 |
gamefan098 Voice
Joined: 19 May 2016 Posts: 8
|
Posted: Mon May 30, 2016 8:35 am Post subject: |
|
|
| 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
| Quote: |
[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 ? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon May 30, 2016 11:32 am Post subject: |
|
|
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:
| Quote: |
.tcl package require tls
Tcl: 1.6
|
Also, would be great if the author could change:
| Code: |
package require Tcl 8.5
package require http 2.7
package require tls
package require json
|
with something like:
| Code: |
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. |
|
| Back to top |
|
 |
gamefan098 Voice
Joined: 19 May 2016 Posts: 8
|
Posted: Mon May 30, 2016 7:13 pm Post subject: Re: YoutubeTitle V2 |
|
|
| Thanx all to all ! @caesar i add tls in my scripts folder before i read your post ... it helps allot! |
|
| Back to top |
|
 |
|