<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/19777" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2018-04-01T23:13:09-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/19777</id>

		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2018-04-01T23:13:09-04:00</updated>

		<published>2018-04-01T23:13:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=106742#p106742</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=106742#p106742"/>
		<title type="html"><![CDATA[Re: YoutubeTitleV2 - Version 2.1 Released]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=106742#p106742"><![CDATA[
Viper YoutubeTitleV2<br>friend its tcl does not work already<br>apparently something modified in the tcl 8.6.6<br>I proved the youtube tcl in tcl 8.5 and it works very well<br><br>error in taryline:<br>[03:12:05] % Failed to find a video: protocol not supported (searching for 'irc').<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Sun Apr 01, 2018 11:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2016-08-22T15:07:34-04:00</updated>

		<published>2016-08-22T15:07:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105359#p105359</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105359#p105359"/>
		<title type="html"><![CDATA[Re: YoutubeTitleV2 - Version 2.1 Released]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105359#p105359"><![CDATA[
great Viper!!!!! thanks <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Mon Aug 22, 2016 3:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Viper]]></name></author>
		<updated>2016-08-22T14:50:21-04:00</updated>

		<published>2016-08-22T14:50:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105358#p105358</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105358#p105358"/>
		<title type="html"><![CDATA[YoutubeTitleV2 - Version 2.1 Released]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105358#p105358"><![CDATA[
Wow.. people are actually using my script..? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_eek.gif" width="15" height="15" alt=":shock:" title="Shocked"> <br>I remember watching this thread for the first few weeks/months after i posted it, but kinda forgot about it after that since it seemed like there was no interest <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>Until recently someone mentioned on IRC he and other people actually use it now, so figured I'd pop in and go through the comments..<br><br>Having done that, i figured a small update to address the 2 items mentioned wouldn't hurt.. and i ended up with a slightly bigger update than expected.. The previous version has no major issues I'm aware of, so this release mostly adds 2 handy features I should have probably added from the start.. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br><strong class="text-strong">Changes</strong><ul><li>Added a default API key since IPs don't need to be individually whitelisted anymore.<br>Added support for YouTube searches returning multiple search results.<br>Added basic anti-flood measures by implementing a minimum interval between searches.<br>Updated dependency checking to be non-fatal to the hosting bot. (Suggested by caesar.)<br>Updated documentation for creating your own API key to match new dev console.<br>Fixed the socket not enabling TLS usage on some systems. (Fix suggested by Madalin.)</li></ul>I've committed everything to my GIT repo so the link in the first post will use the new version unless you specifically select the previous release or commit.. i'll update the first post to add a direct link to be clear <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Git repo <a href="http://git.milanza.org/?p=eggdrop-scripts/YoutubeTitle;a=summary" class="postlink">link</a><br>Direct download <a href="http://git.milanza.org/?p=eggdrop-scripts/YoutubeTitle;a=blob_plain;f=YoutubeTitleV2.tcl;hb=0baa67f85fc429de7be8e93e6a75e73e46eaf6a1" class="postlink">link</a>.<br><br>Note that as mentioned in the notes, you no longer have to bother getting your own API key.. i've added one of my own in the git repo. I can't recall exactly why I didn't do this initially, may have something to do with having to whitelist each IP individually back then..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12427">Viper</a> — Mon Aug 22, 2016 2:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Taken]]></name></author>
		<updated>2016-08-10T12:01:48-04:00</updated>

		<published>2016-08-10T12:01:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105314#p105314</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105314#p105314"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105314#p105314"><![CDATA[
<blockquote class="uncited"><div>second line</div></blockquote>Works! Thanks!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11292">Taken</a> — Wed Aug 10, 2016 12:01 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2016-08-10T11:55:26-04:00</updated>

		<published>2016-08-10T11:55:26-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105313#p105313</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105313#p105313"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105313#p105313"><![CDATA[
second line<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Wed Aug 10, 2016 11:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Taken]]></name></author>
		<updated>2016-08-10T11:28:04-04:00</updated>

		<published>2016-08-10T11:28:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105312#p105312</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105312#p105312"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105312#p105312"><![CDATA[
I have this:<div class="codebox"><p>Code: </p><pre><code>if { [info exists {my-ip}] == 1 &amp;&amp; [string length ${my-ip}] &gt; 0} {        http::register https 443 [list tls::socket -myaddr ${my-ip}]} elseif { [info exists {my-hostname}] == 1 &amp;&amp; [string length ${my-hostname}] &gt; 0} {        http::register https 443 [list tls::socket -myaddr ${my-hostname}]} else {        http::register https 443 tls::socket}</code></pre></div>what change here?<br><br>Thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11292">Taken</a> — Wed Aug 10, 2016 11:28 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2016-08-10T11:17:06-04:00</updated>

		<published>2016-08-10T11:17:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105311#p105311</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105311#p105311"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105311#p105311"><![CDATA[
search for the <div class="codebox"><p>Code: </p><pre><code>::http::register line</code></pre></div>and modify it with <div class="codebox"><p>Code: </p><pre><code>::http::register https 443 [list ::tls::socket -tls1 1] </code></pre></div> or use my version <a href="http://forum.egghelp.org/viewtopic.php?t=20199" class="postlink">http://forum.egghelp.org/viewtopic.php?t=20199</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Wed Aug 10, 2016 11:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Taken]]></name></author>
		<updated>2016-08-10T08:34:09-04:00</updated>

		<published>2016-08-10T08:34:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105310#p105310</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105310#p105310"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105310#p105310"><![CDATA[
<blockquote class="uncited"><div>i'm using eddgrop 1.6.21 i'ts works always but 2 day ago tell me in DCC the reason i posted ! i need to change API key for work again ?<br><br><br> % Failed to get video details: error reading "sock6": software caused connection abort (querying 'Qv-hsIPs3Ak')<br><br> % Failed to get video details: error reading "sock6": software caused connection abort (querying 'Qv-hsIPs3Ak')<br><br><br>i can't understand where is the problem</div></blockquote>Same problem here, only change sock number (my case sock10).<br><br>Any ideas?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11292">Taken</a> — Wed Aug 10, 2016 8:34 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[d3n]]></name></author>
		<updated>2016-08-05T05:38:53-04:00</updated>

		<published>2016-08-05T05:38:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105290#p105290</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105290#p105290"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105290#p105290"><![CDATA[
i'm using eddgrop 1.6.21 i'ts works always but 2 day ago tell me in DCC the reason i posted ! i need to change API key for work again ?<br><br><br> % Failed to get video details: error reading "sock6": software caused connection abort (querying 'Qv-hsIPs3Ak')<br><br> % Failed to get video details: error reading "sock6": software caused connection abort (querying 'Qv-hsIPs3Ak')<br><br><br>i can't understand where is the problem<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12641">d3n</a> — Fri Aug 05, 2016 5:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2016-08-04T17:51:49-04:00</updated>

		<published>2016-08-04T17:51:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105289#p105289</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105289#p105289"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105289#p105289"><![CDATA[
that eggdrop version is using??<br>It works for me well the tcl<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Thu Aug 04, 2016 5:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[d3n]]></name></author>
		<updated>2016-08-03T11:35:08-04:00</updated>

		<published>2016-08-03T11:35:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105288#p105288</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105288#p105288"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105288#p105288"><![CDATA[
i have a problem with Youtube V2 , today doesn't work, title and !yt why ? can help me<br><br>[17:18:22] % Failed to get video details: error reading "sock6": software caused connection abort (querying 's8cOBFStYhM')<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12641">d3n</a> — Wed Aug 03, 2016 11:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2016-06-05T17:31:38-04:00</updated>

		<published>2016-06-05T17:31:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105103#p105103</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105103#p105103"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105103#p105103"><![CDATA[
youtube for m00nie <br>this I recommend it because it gives four simultaneous results also already activated api key....<div class="codebox"><p>Code: </p><pre><code>########################################################################################## Namem00nie::youtube# DescriptionUses youtube v3 API to search and return videos# # Version1.6 - Small correction to "stream" categorisation.....# 1.5 - Added UTF-8 support thanks to CatboxParadox (Requires eggdrop# to be compiled with UTF-8 support)# 1.4 - Correct time format and live streams gaming etc#           1.3 - Updated output to be RFC compliant for some IRCDs# 1.2 - Added auto info grabber for spammed links#1.1 - Fixing regex!#1.0 - Initial release# Websitehttps://www.m00nie.com# NotesGrab your own key @ https://developers.google.com/youtube/v3/#########################################################################################namespace eval m00nie {   namespace eval youtube {package require httppackage require jsonpackage require tlshttp::register https 443 tls::socketbind pub - !yt m00nie::youtube::searchbind pub - .yt m00nie::youtube::searchbind pub - !youtube m00nie::youtube::searchbind pub - .youtube m00nie::youtube::searchbind pubm - * m00nie::youtube::autoinfovariable version "1.6"setudef flag youtubevariable key "AIzaSyD290rR6-rFyDRDD5aOerzxflCfZskE7q0"variable regex {(?:http(?:s|).{3}|)(?:www.|)(?:youtube.com\/watch\?.*v=|youtu.be\/)([\w-]{11})}::http::config -useragent "Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0"proc autoinfo {nick uhost hand chan text} {if {[channel get $chan youtube] &amp;&amp; [regexp -nocase -- $m00nie::youtube::regex $text url id]} {putlog "m00nie::youtube::autoinfo is running"putlog "m00nie::youtube::autoinfo url is: $url and id is: $id"set url "https://www.googleapis.com/youtube/v3/videos?id=$id&amp;key=$m00nie::youtube::key&amp;part=snippet,statistics,contentDetails&amp;fields=items(snippet(title,channelTitle,publishedAt),statistics(viewCount),contentDetails(duration))"set ids [getinfo $url]set title [encoding convertfrom [lindex $ids 0 1 3]]set pubiso [lindex $ids 0 1 1]regsub {\.000Z} $pubiso "" pubisoset pubtime [clock format [clock scan $pubiso]]set user [encoding convertfrom [lindex $ids 0 1 5]]# Yes all quite horrible...set isotime [lindex $ids 0 3 1]regsub -all {PT|S} $isotime "" isotime                regsub -all {H|M} $isotime ":" isotimeif { [string index $isotime end-1] == ":" } {set sec [string index $isotime end]                        set trim [string range $isotime 0 end-1]                        set isotime ${trim}0$sec} elseif { [string index $isotime 0] == "0" } {set isotime "stream"} elseif { [string index $isotime end-2] != ":" } {set isotime "${isotime}s"}set views [lindex $ids 0 5 1]puthelp "PRIVMSG $chan :\002\00301,00You\00300,04Tube\003\002 \002$title\002 by $user (duration: $isotime) on $pubtime, $views views"}}proc getinfo { url } {for { set i 1 } { $i &lt;= 5 } { incr i } {        set rawpage [::http::data [::http::geturl "$url" -timeout 5000]]        if {[string length rawpage] &gt; 0} { break }        }        putlog "m00nie::youtube::getinfo Rawpage length is: [string length $rawpage]"        if {[string length $rawpage] == 0} { error "without answer comeback, :( try it later or check its connection." }        set ids [dict get [json::json2dict $rawpage] items]putlog "m00nie::youtube::getinfo IDS are $ids"return $ids} proc search {nick uhost hand chan text} {putlog "m00nie::youtube::search is running"regsub -all {\s+} $text "%20" textset url "https://www.googleapis.com/youtube/v3/search?part=snippet&amp;fields=items(id(videoId),snippet(title))&amp;key=$m00nie::youtube::key&amp;q=$text"set ids [getinfo $url]set output "\002\00301,00You\00300,04Tube\003\002 "for {set i 0} {$i &lt; 5} {incr i} {set id [lindex $ids $i 1 1]set desc [encoding convertfrom [lindex $ids $i 3 1]]set yout "https://youtu.be/$id"append output "\002" $desc "\002 - " $yout " | "}set output [string range $output 0 end-2]puthelp "PRIVMSG $chan :$output"}}}putlog "m00nie::youtube $m00nie::youtube::version loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Sun Jun 05, 2016 5:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2016-06-05T17:29:36-04:00</updated>

		<published>2016-06-05T17:29:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105102#p105102</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105102#p105102"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105102#p105102"><![CDATA[
Youtube Title V2 for Jan Milants  this TCL already has a working key Use it<br><div class="codebox"><p>Code: </p><pre><code>################################################################################  Name:                  Youtube Title V2#  Author:                Jan Milants &lt;viper@anope.org&gt;#  Version:               2.0     (28/08/2014)#  Eggdrop Version:       1.6.x#  Requires TCL version:  8.5#  Package dependencies:  http, tls, json#  Credits:               Based on original YouTube Script#                             by jotham.read@gmail.com#                         Design inspiration from#                             youtube.tcl by Mookie.################################################################################ Description# -------------# The script monitors text channels for links to Youtube.# When found, it will query the google server for details such as video title# and number of views of the youtube video and advertise the results in the channel.# The script also supports searching youtube with the command "!youtube &lt;search text&gt;"# or "!yt &lt;search text&gt;". In response, the search query will be passed on to the# youtube API and the best ranking result will be linked in channel.## This script will be active on any channel it resides in with the "youtube" flag.# The flag can be set in the console with ".chanset #chan +youtube" or with the # in channel command "!youtube on". Both commands only work for users with flag mno.## Getting your own Google API key# ---------------------------------# This script uses the Google Youtube Data API V3, which requires an API key to# authorize access to the API and is used as basis for limiting request per day etc.# Instructions can be found on #     https://developers.google.com/youtube/registering_an_application# Required steps in short:#     1. Go to the Google developers console https://console.developers.google.com#     2. Create a new project. Give it a name like 'eggdrop', doesn't matter much.#     3. When the project is loaded, select menu "APIs" under "APIs &amp; auth"#     4. In the list of APIs, enable the "YouTube Data API v3".#     5. Select menu "Credentials" and click "Create new key".#     6. Select key type "server".#     7. Fill in the IP(s) or IP range from which the eggdrop bot will send#        requests to google's servers. This is a whitelist, if the request#        comes from a different IP, it will be rejected.#        Note: If my-ip or my-hostname is configured in eggdrop.conf, they should#              be entered here.#     8. You now have an API KEY; copy it to the config section below.## !!! IMPORTANT !!!# When loading this script alongside other scripts which initiate web service calls,# ensure this script is loaded last! The script creates a handler for HTTPS connection# and sets the source IP to the my-ip or my-hostname from eggdrop.conf.# Most other scripts will not correctly enforce the source IP of requests and # can overwrite this scripts HTTPS handler. This results in connections coming from another# IP on the machine and may thus be rejected by the Google API Servers. # The typical error message logged would be "Error processing web service reply".#################################################################################  Changes:#  2.00 28/08/14#    Started development (Jan).#    Almost complete rewrite most notable changes:#        * Use the YouTube Data API V3. (Requires TLS support!)#        * Strip out flat_json_decoder and use json &amp; dict packages instead.#        * Strip out tinyurl support. Better to use youtu.be in the response.#        * 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.#  0.51 09/30/13#    Small correction for caps in url (but not video id)#  0.5 01/02/09#    Added better error reporting for restricted youtube content.#  0.4 10/11/09#    Changed title scraping method to use the oembed api.#    Added crude JSON decoder library.#  0.3 02/03/09#    Fixed entity decoding problems in return titles.#    Added customisable response format.#    Fixed rare query string bug.#################################################################################  Configuration################################################################################# API key assigned to your Google account.# Sadly, everyone will have to register with Google and request their own API key.# An API key is linked to an IP or mask, so you will need to register one for your own.# Find detailed instructions above.set youtube(api_key)  "AIzaSyD290rR6-rFyDRDD5aOerzxflCfZskE7q0"# Base URI for links to youtube videos.# Either use the normal youtube link or youtu.be for shorter URLs.# I'd recommend keeping the HTTPS to avoid exposing user data.set youtube(base_url)          "https://www.youtube.com/watch?v="#set youtube(base_url)          "https://www.youtu.be/"# Date/time format# The format to be used when showing dates, for example in publish date.# All times are in UTC.## Available tokens:#   %year%          4 digit year notation#   %month%         2 digit month notation#   %day%           2 digit day of the month notation#   %hours%          2 digit hour notation on a 24hours basis#   %minutes%       2 digit minutes notation#   %seconds%       2 digit seconds notation## Example:#     "%day%/%month%/%year% %hours%:%minutes% UTC"set youtube(date_format)   "%day%/%month%/%year% %hours%:%minutes% UTC"# Response Formats# Template of the reply to be send to the channel showing the youtube video details.# A separate response can be set for replies to a pasted URL or to a query.## Available tokens in the response format:#   %botnick%       Nickname of bot#   %poster%        Nickname of person who posted the youtube link#   %youtube_url%   URL to the youtube link (This may not be the exact same#                   URL that was posted since it's rewritten based on the format#                   above to ensure all links posted by the bot are HTTPS.)#   %id%            ID of the linked youtube video.#   %author%        Author/Uploader/channel of the video.#   %title%         Title of youtube link#   %description%   Description of the video.#                   (Note that this is generally a VERY long text!)#   %published%     Date &amp; time the video was published.#   %views%         The number of times the video has been viewed.#   %likes%         The number of users who have "liked" the video.#   %dislikes%      The number of users who have "disliked" the video.#   %length%        Length of the video.# Tokens only available in the response to searches (q_resp_format):#   %query%         The original search string.## Example:#     "\002YouTube\002: %poster%: %youtube_url% - \"\002%title%\002\" (Uploaded by \"%author%\" on %published%) - Length: %length% - Views: %views%  - Likes / Dislikes: %likes% / %dislikes%"# The template used when looking up a URL found in the channelset youtube(response_format)   "\002YouTube\002: %poster%: %youtube_url% - \"\002%title%\002\" (Uploaded by \"%author%\" on %published%) - Length: %length% - Views: %views%  - Likes / Dislikes: %likes% / %dislikes%"# The template used when replying to a search query.set youtube(q_resp_format)     "\002YouTube\002: %poster%: Top result for searching '%query%': %youtube_url% - \"\002%title%\002\" (Uploaded by \"%author%\" on %published%) - Length: %length% - Views: %views%  - Likes / Dislikes: %likes% / %dislikes%"# The maximum number of characters from a youtube title to printset youtube(max_title_length)  64# The maximum number of characters from a youtube description to printset youtube(max_desc_length)   128#################################################################################  Advanced Configuration#  !!! DO NOT CHANGE UNLESS YOU KNOW WHAT YOU'RE DOING !!!################################################################################# URLs of the youtube V3 APIset youtube(api_get)           "https://www.googleapis.com/youtube/v3/videos"set youtube(api_search)        "https://www.googleapis.com/youtube/v3/search"# The groups of properties to be fetchedset youtube(api_part)          "snippet,statistics,contentDetails"# The fields from the selected property groups that are to be returnedset youtube(api_fields)        "items(id,snippet(publishedAt,title,description,channelTitle),statistics,contentDetails(duration))"# Maximum time in milliseconds to wait for youtube to respondset youtube(api_timeout)       "30000"# Pattern used to patch youtube links in channel public textset youtube(pattern)           {https{0,1}://.*youtu(?:\.be/|be\..*/watch\?(?:.*)v=)([A-Za-z0-9_\-]+)}###############################################################################package require Tcl 8.5package require http 2.7package require tlspackage require json# We need HTTPS support for the Google APIs..# If local IP or host is configured in the main config, use it as the source# of the outgoing connections.if { [info exists {my-ip}] == 1 &amp;&amp; [string length ${my-ip}] &gt; 0} {http::register https 443 [list tls::socket -myaddr ${my-ip}]} elseif { [info exists {my-hostname}] == 1 &amp;&amp; [string length ${my-hostname}] &gt; 0} {http::register https 443 [list tls::socket -myaddr ${my-hostname}]} else {http::register https 443 tls::socket}set YoutubeTitleVersion "2.0"setudef flag youtubebind pubm - * public_youtubebind pub - !youtube youtube_querybind pub - !yt youtube_query###############################################################################proc note {msg} {  putlog "% $msg"}# Ensure strings are no longer then given length. This will cutoff the string# at the desired length and append '...'.proc shorten {text maxlen} {if { [string length $text] &gt; [expr $maxlen - 1] } {set text [string range $text 0 [expr $maxlen - 4]]"..."}return $text}# Convert an ISO8601 date into a more readable format..proc conv_iso8601_date {orig_date} {global youtubeset pattern {(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d{1}|3[012])[T\s](?:(?:([01]\d|2[0-3]):([0-5]\d))|(24):(00)):(?:([0-5]\d)(?:[\.,](\d+))?|(60)(?:[\.,](0+))?)Z}if { [regexp $pattern $orig_date match year month day hours minutes hours_2 minutes_2 seconds milliseconds seconds_2 milliseconds_2] } {# The hour and hour_2 variables are mutually exclusive, so we append the _2 variables to# the original ones to have fewer variables to work with.append hours $hours_2append minutes $minutes_2append seconds $seconds_2# Put everything in a dictionary so we can have a configurable time format.set tokens [dict create]dict set tokens %year% $yeardict set tokens %month% $monthdict set tokens %day% $daydict set tokens %hours% $hoursdict set tokens %minutes% $minutesdict set tokens %seconds% $secondsreturn [string map $tokens $youtube(date_format)]} else {error "Unable to process date value ($orig_date) returned by web service."}}# Convert an ISO8601 duration into a more readable format..proc conv_iso8601_duration {duration} {set length ""set pattern {P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)}if { [regexp $pattern $duration match years months days hours minutes seconds] } {if { [string length $years] &gt; 0 } {append length $years Y " "}if { [string length $months] &gt; 0 } {append length $months M " "}if { [string length $days] &gt; 0 } {append length $days D " "}if { [string length $hours] &gt; 0 } {append length $hours h " "}if { [string length $minutes] &gt; 0 } {append length $minutes m " "}if { [string length $seconds] &gt; 0 } {append length $seconds s " "}} else {error "Unable to process duration value ($duration) returned by web service."}return [string trim $length]}################################################################################ Process the reply string of a video lookup from the Youtube API (JSON) and add the# data to a dictionary containing all tokens the user will be able to use in the template.proc read_props {json_blob} {global youtube# Create an empty dictionary for the variables supported in the response format.set properties [dict create]# Convert the JSON response to a dictionary.set reply [json::json2dict $json_blob]# The web service returns a list of results, even though our query will always get 1.# So we have to take the first element from the list..if { ![dict exists $reply items] } {error "Error processing web service reply."} else {set video [lindex [dict get $reply items] 0]# Check whether the variables we support in the response are present in the# reply from the web service. We check this one by one instead of assuming# they exist in case the API changes or someone messes with the requested fields.# Properties of the view we extract from reply..if { [dict exists $video id] } {dict set properties %id% [dict get $video id]} else {dict set properties %id% ""}if { [dict exists $video snippet channelTitle] } {dict set properties %author% [dict get $video snippet channelTitle]} else {dict set properties %author% ""}if { [dict exists $video snippet title] } {dict set properties %title% [shorten "[dict get $video snippet title]" $youtube(max_title_length)]} else {dict set properties %title% ""}if { [dict exists $video snippet description] } {dict set properties %description% [shorten "[dict get $video snippet description]" $youtube(max_desc_length)]]} else {dict set properties %description% ""}if { [dict exists $video snippet publishedAt] } {dict set properties %published% [conv_iso8601_date [dict get $video snippet publishedAt]]} else {dict set properties %published% ""}if { [dict exists $video statistics viewCount] } {dict set properties %views% [dict get $video statistics viewCount]} else {dict set properties %views% ""}if { [dict exists $video statistics likeCount] } {dict set properties %likes% [dict get $video statistics likeCount]} else {dict set properties %likes% ""}if { [dict exists $video statistics dislikeCount] } {dict set properties %dislikes% [dict get $video statistics dislikeCount]} else {dict set properties %dislikes% ""}if { [dict exists $video contentDetails duration] } {dict set properties %length% [conv_iso8601_duration [dict get $video contentDetails duration]]} else {dict set properties %length% ""}}return $properties}# Process the reply string of a search query to the Youtube API (JSON) and extract the # video id of the first result from the reply.proc read_searchres {json_blob} {global youtube# Create an empty dictionary for the variables supported in the response format.set video_id ""# Convert the JSON response to a dictionary.set reply [json::json2dict $json_blob]# The web service returns a list of results, even though our query will always get 1.# So we have to take the first element from the list..if { ![dict exists $reply items] } {error "Error processing web service reply."} else {set res [lindex [dict get $reply items] 0]if { [dict exists $res id videoId] } {set video_id [dict get $res id videoId]}}return $video_id}# Send a request to the youtube API to fetch the video details for# the video with the given ID.proc fetch_props {youtube_id} {global youtube# Ensure an API key has been configured..if { [info exists youtube(api_key)] == 0 || [string length $youtube(api_key)] == 0 } {error "An API key must be configured to access the Google web API!"} else {set query [http::formatQuery id $youtube_id key $youtube(api_key) \part $youtube(api_part) fields $youtube(api_fields)]set response [http::geturl "$youtube(api_get)?$query" -timeout $youtube(api_timeout)]upvar #0 $response stateif [expr [http::ncode $response] == 401] {error "Location contained restricted embed data."} else {set response_body [http::data $response]http::cleanup $responsereturn [read_props $response_body]}}}# Find the video ID of the first match for the given search.proc search_video {criteria} {global youtube# Ensure an API key has been configured..if { [info exists youtube(api_key)] == 0 || [string length $youtube(api_key)] == 0 } {error "An API key must be configured to access the Google web API!"} else {set query [http::formatQuery type "video" q $criteria key $youtube(api_key) \part "id" fields "items(id(videoId))" maxResults "1"]set response [http::geturl "$youtube(api_search)?$query" -timeout $youtube(api_timeout)]upvar #0 $response stateif [expr [http::ncode $response] == 401] {error "Location contained restricted embed data."} else {set response_body [http::data $response]http::cleanup $responsereturn [read_searchres $response_body]}}}################################################################################ This is triggered to analyse ever channel message for the presence of the youtube URL.# When one is found, the ID is extracted and passed on to get a list of the video properties.# Finally, this list is used to fill in the tokens in the user defined reply template.proc public_youtube {nick userhost handle channel args} {global youtube botnickif { [channel get $channel youtube] &amp;&amp; [regexp -nocase -- $youtube(pattern) $args match video_id] } {if { [catch {set tokens [fetch_props $video_id]} error] } {note "Failed to get video details: $error (querying '$video_id')"# If the reply contained an empty ID, we assume we found no video..} elseif { [string length [dict get $tokens %id%]] == 0 } {putserv "PRIVMSG $channel :Unable to find a youtube video with ID '$video_id'."} else {dict set tokens %botnick% $botnickdict set tokens %poster% $nick# Rebuild the URL so we use a url shortener or force SSL# in all messages coming from usdict set tokens %youtube_url% "$youtube(base_url)$video_id"set result [string map $tokens $youtube(response_format)]putserv "PRIVMSG $channel :$result" }}}# This is triggered on !youtube commands.# Allows turning monitoring on or off by admins.# All other queries are interpreted as a youtube search.proc youtube_query {nick userhost handle channel args} {global youtube botnick# We get a list of arguments, join it to get rid of the curly braces..set args [join $args]if  { [string length $args] == 0 } {if { [channel get $channel youtube] } {putserv "PRIVMSG $channel :Syntax: \002!youtube &lt;search criteria&gt;\002 - Search for a video."}if { [matchattr $handle +mno|+mno $channel] } {putserv "NOTICE $nick :Syntax: \002!youtube &lt;on/off&gt;\002 - Turn youtube link lookups on/off."}} elseif { [matchattr $handle +mno|+mno $channel] &amp;&amp; ([string compare $args "on"] == 0 \|| [string compare $args "off"] == 0) } {if { ![channel get $channel youtube] &amp;&amp; [string compare $args "on"] == 0 } {channel set $channel +youtubeputserv "NOTICE $nick :YoutubeTitleV2: enabled on $channel"note "YoutubeTitleV2: Monitoring enabled by $nick for $channel."} elseif { [channel get $channel youtube] &amp;&amp; [string compare $args "off"] == 0 } {channel set $channel -youtubeputserv "NOTICE $nick :YoutubeTitleV2: disabled on $channel"note "YoutubeTitleV2: Monitoring disabled by $nick for $channel."}# The magic number comes from the length of the string "cat".. ;)} elseif { [channel get $channel youtube] &amp;&amp; [string length $args] &lt; 3 } {putserv "PRIVMSG $channel :Search criteria must be at least 3 characters long."} elseif { [channel get $channel youtube] } {# Search a video...# Note that we have to do 2 requests: one to fetch search results (id)# and a second to get video details. This is caused by the youtube API # not being capable of returning details in the search functions.if { [catch { set video_id [search_video $args] } error ] } {note "Failed to find a video: $error (searching for '$args')."# If the reply contained an empty ID, we assume we found no video..} elseif { [string length $video_id] == 0 } {putserv "PRIVMSG $channel :Unable to find a youtube video matching search '$args'" # We have the video id, now find the properties..} elseif { [catch {set tokens [fetch_props $video_id]} error] } {note "Failed to get video details: $error (searching for '$args' and found '$video_id')."# If the reply contained an empty ID, we assume we found no video..} elseif { [string length [dict get $tokens %id%]] == 0 } {putserv "PRIVMSG $channel :Unable to fetch the video details of '$video_id' for the search result '$args'"} else {dict set tokens %botnick% $botnickdict set tokens %poster% $nickdict set tokens %query% $args# Rebuild the URL so we use a url shortener or force SSL# in all messages coming from usdict set tokens %youtube_url% "$youtube(base_url)$video_id"set result [string map $tokens $youtube(q_resp_format)]putserv "PRIVMSG $channel :$result" }}}###############################################################################note "YoutubeTitleV2 Version $YoutubeTitleVersion: loaded";</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Sun Jun 05, 2016 5:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2016-06-05T03:12:48-04:00</updated>

		<published>2016-06-05T03:12:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105101#p105101</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105101#p105101"/>
		<title type="html"><![CDATA[YoutubeTitle V2 - Version 2.1 (22/08/16)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105101#p105101"><![CDATA[
<blockquote class="uncited"><div>[14:37:12] Tcl error in file 'mrt.conf':<br>[14:37:12] wrong # args: should be "set varName ?newValue?"</div></blockquote>You get that error cos you copy/pasted the file incorrectly. Download the file to your PC and upload it to the scripts folder again.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sun Jun 05, 2016 3:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Arnold_X-P]]></name></author>
		<updated>2016-06-05T17:24:03-04:00</updated>

		<published>2016-06-04T15:58:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105100#p105100</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105100#p105100"/>
		<title type="html"><![CDATA[Re: YoutubeTitle V2]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105100#p105100"><![CDATA[
TCL good finally understood how it works<br>in windrop<br><strong class="text-strong">step 1</strong><br>conf down and add in three tcl:<br><br><a href="http://www.geocities.ws/mirczn/http.tcl" class="postlink">http.tcl</a><br><a href="http://www.geocities.ws/mirczn/tls.tcl" class="postlink">tls.tcl</a><br><a href="http://www.geocities.ws/mirczn/json.tcl" class="postlink">json.tcl</a><br><br>these three add tcl in the conf:<br>      source scripts/http.tcl<br>      source scripts/tls.tcl<br>      source scripts/json.tcl <br><br><strong class="text-strong">step two</strong><br><strong class="text-strong">then down</strong><br><a href="https://sourceforge.net/projects/tls/files/tls/1.6/tls1.6-win32.zip/download?use_mirror=liquidtelecom&amp;r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ftls%2F&amp;use_mirror=hivelocity" class="postlink">tls lib</a><br><strong class="text-strong">unzip the contents and paste in your directory</strong>.  example;<br> \lib\tcl8.5<br><br>and that's all ready, will be working well...<br><br>[18:05] &lt;Arnold_X-P&gt; .yt <br>[17:17] &lt;Arnold_X-P&gt; .yt irc<br>[17:17] &lt;@JulieTh&gt; 01,00You00,04Tube  - <a href="https://youtu.be/IRC" class="postlink">https://youtu.be/IRC</a> TV | IRC Ko Whatsapp Par Kaise Join Kare Aur Adv. Faiz Syed Kiyon Groups Me Reply Nahi Karte - <a href="https://youtu.be/TPWa6httLoM" class="postlink">https://youtu.be/TPWa6httLoM</a> | Why IRC is the Best Social Network - <a href="https://youtu.be/xFvBzIP4OSo" class="postlink">https://youtu.be/xFvBzIP4OSo</a> | IRC Chat For Beginners - <a href="https://youtu.be/9E4uskXmPVI" class="postlink">https://youtu.be/9E4uskXmPVI</a> | Jo Namaz Chut Jai To Unhe Kaise Padhe By Adv. Faiz Syed - <a href="https://youtu.be/XmyLqTeDZqg" class="postlink">https://youtu.be/XmyLqTeDZqg</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8327">Arnold_X-P</a> — Sat Jun 04, 2016 3:58 pm</p><hr />
]]></content>
	</entry>
	</feed>
