<?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/19134" />

	<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>2012-10-22T08:13:55-04:00</updated>

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

		<entry>
		<author><name><![CDATA[ZzozZ]]></name></author>
		<updated>2012-10-22T08:13:55-04:00</updated>

		<published>2012-10-22T08:13:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100161#p100161</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100161#p100161"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100161#p100161"><![CDATA[
I copy code and write .chanset #Games +saveyt but isn't work :/<br>----------------------------------------<br>I was forgot to add http.tcl, but now when i write<br><a href="http://www.youtube.com/watch?v=PLrB0PDmsFw" class="postlink">www.youtube.com/watch?v=PLrB0PDmsFw</a> isnt worck :/<br><br>Now worck only with:<br><a href="http://youtube.com/watch?v=PLrB0PDmsFw" class="postlink">http://youtube.com/watch?v=PLrB0PDmsFw</a><br><a href="https://youtube.com/watch?v=PLrB0PDmsFw" class="postlink">https://youtube.com/watch?v=PLrB0PDmsFw</a><br><br>and when i write working link i see <div class="codebox"><p>Code: </p><pre><code>[03:25] &lt;ZzozZ&gt; [15:25:28] Tcl error [nzbm:youtube:match]: couldn't open "text/youtube.db": no such file or directory</code></pre></div>in the partyline :/<br><br>I create folder text and file youtube.db in text folder, but i see same message :/<br>---Edit-----------------------------------------------------<br>The code on <a href="http://forum.egghelp.org/viewtopic.php?p=99460#99460" class="postlink">this</a> post works purfect <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=11419">ZzozZ</a> — Mon Oct 22, 2012 8:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-10-20T18:07:38-04:00</updated>

		<published>2012-10-20T18:07:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100158#p100158</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100158#p100158"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100158#p100158"><![CDATA[
yep.. edited script i pasted above <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br>reload the script and do <div class="codebox"><p>Code: </p><pre><code>.chanset #chan +savety</code></pre></div>from the partyline<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Sat Oct 20, 2012 6:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[heartbroken]]></name></author>
		<updated>2012-10-19T19:19:34-04:00</updated>

		<published>2012-10-19T19:19:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100156#p100156</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100156#p100156"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100156#p100156"><![CDATA[
i guess need to add a line on the top of the code like :<div class="codebox"><p>Code: </p><pre><code>setudef flag saveyt</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11703">heartbroken</a> — Fri Oct 19, 2012 7:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ZzozZ]]></name></author>
		<updated>2012-10-19T18:56:02-04:00</updated>

		<published>2012-10-19T18:56:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100155#p100155</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100155#p100155"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100155#p100155"><![CDATA[
<blockquote class="uncited"><div></div></blockquote>when i try your script i see this message <div class="codebox"><p>Code: </p><pre><code>&lt;ZzozZ&gt; [01:54:40] Tcl error [nzbm:youtube:match]: Unknown channel setting.</code></pre></div> in dcc chat.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11419">ZzozZ</a> — Fri Oct 19, 2012 6:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-10-20T18:05:01-04:00</updated>

		<published>2012-10-16T06:18:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100145#p100145</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100145#p100145"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100145#p100145"><![CDATA[
@tomekk<br><br>forgot the http package dont support ssl, i use this script i wrote for youtube.. works with all variations of youtube urls <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> also saves the embeded code urls to a file so you could display them via a webpage <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>looks like this in channel.. <br><br><img src="http://i.imgur.com/xqkoS.jpg" class="postimage" alt="Image"><br><br>and the webpage you could make.. <a href="http://goo.gl/TQN9G" class="postlink">http://goo.gl/TQN9G</a><br><div class="codebox"><p>Code: </p><pre><code>bind pubm -|- "% *http*://*youtube.com*" nzbm:youtube:match bind pubm -|- "% *http*://*youtu.be*" nzbm:youtube:match setudef flag saveyt proc nzbm:youtube:match {nick uhost hand chan text} {if {[channel get $chan saveyt] == 1 } {  if {[regexp -nocase {http://*youtube.com/watch\?(.*)v=([A-Za-z0-9_\-]+)} $text match fluff youtubeid]} {} elseif {[regexp -nocase {https://*youtube.com/watch\?(.*)v=([A-Za-z0-9_\-]+)} $text match fluff youtubeid]} {} elseif {[regexp -nocase {https://*youtu.be/([A-Za-z0-9_\-]+)} $text match youtubeid]} {} elseif {[regexp -nocase {http://*youtu.be/([A-Za-z0-9_\-]+)} $text match youtubeid]} {} else { return }set youtube_query "http://www.youtube.com/oembed?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D$youtubeid&amp;format=xml"set youtube_save "http://www.youtube.com/embed/$youtubeid"::http::config -useragent "Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.8.1) Gecko/2006101023 Firefox/2.0"set url [::http::geturl $youtube_query -timeout 5000]set html [::http::data $url]::http::cleanup $htmlregexp -nocase {&lt;title&gt;(.*?)&lt;/title&gt;} $html match title set title [nzbm:html:decode $title]if {$title==0} {return}set logo "\002\0031,00 You\0031,00 \00300,04 Tube \00300,04\003\002\00314"putserv "privmsg $chan :$logo \"$title\""set file [open text/youtube.db r] set data [read $file] close $file set isdupe 0 foreach line [split $data \n] { if { [string match -nocase "*$youtube_save*" "$line"] == 1 } { catch {unset data} set isdupe 1  } } if {$isdupe == 1} { return } else {set fp [open text/youtube.db "a"] puts $fp $youtube_save close $fp  } }}proc nzbm:html:decode {content} { if {$content == ""} { return 0; } if {![string match *&amp;* $content]} { return $content; } set escapes {   \x20 " \x22 &amp; \x26 &amp;apos; \x27 – \x2D &lt; \x3C &gt; \x3E ˜ \x7E € \x80 ¡ \xA1 ¢ \xA2 £ \xA3 ¤ \xA4 ¥ \xA5 ¦ \xA6 § \xA7 ¨ \xA8 © \xA9 ª \xAA « \xAB ¬ \xAC ­ \xAD ® \xAE &amp;hibar; \xAF ° \xB0 ± \xB1 ² \xB2 ³ \xB3 ´ \xB4 µ \xB5 ¶ \xB6 · \xB7 ¸ \xB8 ¹ \xB9 º \xBA » \xBB ¼ \xBC ½ \xBD ¾ \xBE ¿ \xBF À \xC0 Á \xC1 Â \xC2 Ã \xC3 Ä \xC4 Å \xC5 Æ \xC6 Ç \xC7 È \xC8 É \xC9 Ê \xCA Ë \xCB Ì \xCC Í \xCD Î \xCE Ï \xCF Ð \xD0 Ñ \xD1 Ò \xD2 Ó \xD3 Ô \xD4 Õ \xD5 Ö \xD6 × \xD7 Ø \xD8 Ù \xD9 Ú \xDA Û \xDB Ü \xDC Ý \xDD Þ \xDE ß \xDF à \xE0 á \xE1 â \xE2 ã \xE3 ä \xE4 å \xE5 æ \xE6 ç \xE7 è \xE8 é \xE9 ê \xEA ë \xEB ì \xEC í \xED î \xEE ï \xEF ð \xF0 ñ \xF1 ò \xF2 ó \xF3 ô \xF4 õ \xF5 ö \xF6 ÷ \xF7 ø \xF8 ù \xF9 ú \xFA û \xFB ü \xFC ý \xFD þ \xFE ÿ \xFF }; set content [string map $escapes $content]; set content [string map [list "\]" "\\\]" "\[" "\\\[" "\$" "\\\$" "\\" "\\\\"] $content]; regsub -all -- {&amp;#([[:digit:]]{1,5});} $content {[format %c [string trimleft "\1" "0"]]} content; regsub -all -- {&amp;#x([[:xdigit:]]{1,4});} $content {[format %c [scan "\1" %x]]} content; regsub -all -- {&amp;#?[[:alnum:]]{2,7};} $content "?" content; return [subst $content]; }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Tue Oct 16, 2012 6:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2012-10-16T06:03:01-04:00</updated>

		<published>2012-10-16T06:03:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100144#p100144</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100144#p100144"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100144#p100144"><![CDATA[
@doggo<br>REGEXP will work, but not the http:get.<br>If you want to use https you need to add TLS support and ::http::register<br><br>@ZzozZ<br>Do a little trick:<br>change:<div class="codebox"><p>Code: </p><pre><code>proc public_youtube {nick userhost handle channel args} {    global youtube botnick    if {[regexp -nocase -- $youtube(pattern) $args match fluff video_id]} { </code></pre></div>to:<div class="codebox"><p>Code: </p><pre><code>proc public_youtube {nick userhost handle channel args} {    global youtube botnick    regsub -all -nocase "https" $args "http" args    if {[regexp -nocase -- $youtube(pattern) $args match fluff video_id]} { </code></pre></div>It should work.<br>I think every https*youtube link should work with http. (without secure pages like login etc.)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Tue Oct 16, 2012 6:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-10-16T05:51:24-04:00</updated>

		<published>2012-10-16T05:51:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100140#p100140</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100140#p100140"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100140#p100140"><![CDATA[
find this in the code <br><div class="codebox"><p>Code: </p><pre><code># Pattern used to patch youtube links in channel public text set youtube(pattern) {http://.*youtube.*/watch\?(.*)v=([A-Za-z0-9_\-]+)}</code></pre></div>and alter to<br><div class="codebox"><p>Code: </p><pre><code># Pattern used to patch youtube links in channel public text set youtube(pattern) {http*://.*youtube.*/watch\?(.*)v=([A-Za-z0-9_\-]+)}</code></pre></div> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11046">doggo</a> — Tue Oct 16, 2012 5:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ZzozZ]]></name></author>
		<updated>2012-10-15T19:20:07-04:00</updated>

		<published>2012-10-15T19:20:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100139#p100139</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100139#p100139"/>
		<title type="html"><![CDATA[Youtube title TCL problem, help.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100139#p100139"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>################################################################################  Name:                                        Youtube Title#  Author:                                      jotham.read@gmail.com#  Credits:                                     tinyurl proc taken from#                                                  tinyurl.tcl by jer@usa.com.#                                               design inspiration from#                                                  youtube.tcl by Mookie.#  Eggdrop Version:     1.6.x#  TCL version 8.1.1 or newer http://wiki.tcl.tk/450##  Changes:#  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################################################################################# Maximum time to wait for youtube to respondset youtube(timeout)            "30000"# Youtube oembed location to use as source for title queries. It is best to use# nearest youtube location to you.  For example http://uk.youtube.com/oembedset youtube(oembed_location)    "http://www.youtube.com/"# Use tinyurl service to create short version of youtube URL. Values can be# 0 for off and 1 for on.set youtube(tiny_url)           0# Response Format# %botnick%         Nickname of bot# %post_nickname%   Nickname of person who posted youtube link# %title%           Title of youtube link# %youtube_url%     URL of youtube link# %tinyurl%         Tiny URL for youtube link. tiny_url needs to be set above.# Example:# set youtube(response_format) "\"%title%\" ( %tinyurl% )"set youtube(response_format) "Youtube Title: \"%title%\""# Bind syntax, alter as suits your needsbind pubm - * public_youtube# Pattern used to patch youtube links in channel public textset youtube(pattern) {http://.*youtube.*/watch\?(.*)v=([A-Za-z0-9_\-]+)}# This is just used to avoid recursive loops and can be ignored.set youtube(maximum_redirects)  2# The maximum number of characters from a youtube title to printset youtube(maximum_title_length) 256###############################################################################package require httpset gTheScriptVersion "0.5"proc note {msg} {  putlog "% $msg"}###############################################################################proc make_tinyurl {url} { if {[info exists url] &amp;&amp; [string length $url]} {  if {[regexp {http://tinyurl\.com/\w+} $url]} {   set http [::http::geturl $url -timeout 9000]   upvar #0 $http state ; array set meta $state(meta)   ::http::cleanup $http ; return $meta(Location)  } else {   set http [::http::geturl "http://tinyurl.com/create.php" \     -query [::http::formatQuery "url" $url] -timeout 9000]   set data [split [::http::data $http] \n] ; ::http::cleanup $http   for {set index [llength $data]} {$index &gt;= 0} {incr index -1} {    if {[regexp {href="http://tinyurl\.com/\w+"} [lindex $data $index] url]} {     return [string map { {href=} "" \" "" } $url] }}}} error "failed to get tiny url."}###############################################################################proc flat_json_decoder {info_array_name json_blob} {   upvar 1 $info_array_name info_array   # 0 looking for key, 1 inside key, 2 looking for value, 3 inside value    set kvmode 0   set cl 0   set i 1    set length [string length $json_blob]   while { $i &lt; $length } {      set c [string index $json_blob $i]      if { [string equal $c "\""] &amp;&amp; [string equal $cl "\\"] == 0 } {         if { $kvmode == 0 } {            set kvmode 1            set start [expr $i + 1]         } elseif { $kvmode == 1 } {            set kvmode 2            set name [string range $json_blob $start [expr $i - 1]]         } elseif { $kvmode == 2 } {            set kvmode 3            set start [expr $i + 1]         } elseif { $kvmode == 3 } {            set kvmode 0            set info_array($name) [string range $json_blob $start [expr $i - 1]]         }      }      set cl $c      incr i 1   }}proc filter_title {blob} {   # Try and convert escaped unicode   set blob [subst -nocommands -novariables $blob]   set blob [string trim $blob]   set blob}proc extract_title {json_blob} {   global youtube   array set info_array {}   flat_json_decoder info_array $json_blob   if { [info exists info_array(title)] } {      set title [filter_title $info_array(title)]   } else {      error "Failed to find title.  JSON decoding failure?"   }   if { [string length $title] &gt; $youtube(maximum_title_length) - 1 } {      set title [string range $title 0 $youtube(maximum_title_length)]"..."   } elseif { [string length $title] == 0 } {      set title "No usable title."   }   return $title}###############################################################################proc fetch_title {youtube_uri {recursion_count 0}} {    global youtube    if { $recursion_count &gt; $youtube(maximum_redirects) } {        error "maximum recursion met."    }    set query [http::formatQuery url $youtube_uri]    set response [http::geturl "$youtube(oembed_location)?$query" -timeout $youtube(timeout)]    upvar #0 $response state    foreach {name value} $state(meta) {        if {[regexp -nocase ^location$ $name]} {            return [fetch_title $value [incr recursion_count]]        }    }if [expr [http::ncode $response] == 401] {error "Location contained restricted embed data."} else {    set response_body [http::data $response]    http::cleanup $response    return [extract_title $response_body]}}proc public_youtube {nick userhost handle channel args} {    global youtube botnick    if {[regexp -nocase -- $youtube(pattern) $args match fluff video_id]} {        note "Fetching title for $match."        if {[catch {set title [fetch_title $match]} error]} {            note "Failed to fetch title: $error"        } else {            set tinyurl $match            if { $youtube(tiny_url) == 1 &amp;&amp; \              [catch {set tinyurl [make_tinyurl $match]}]} {               note "Failed to make tiny url for $match."            }            set tokens [list %botnick% $botnick %post_nickname% \                $nick %title% "$title" %youtube_url% \                "$match" %tinyurl% "$tinyurl"]            set result [string map $tokens $youtube(response_format)]            putserv "PRIVMSG $channel :$result"         }    }}###############################################################################note "youtube_title$gTheScriptVersion: loaded";</code></pre></div>I use this tcl, but when i try to past url starting with https:// this tcl didnt respond ....<br>Can you make it to work with https:// ??<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11419">ZzozZ</a> — Mon Oct 15, 2012 7:20 pm</p><hr />
]]></content>
	</entry>
	</feed>
