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

	<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-08-03T20:22:07-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Nash]]></name></author>
		<updated>2012-08-03T20:22:07-04:00</updated>

		<published>2012-08-03T20:22:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99817#p99817</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99817#p99817"/>
		<title type="html"><![CDATA[[YouTitle] tcl error + small changes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99817#p99817"><![CDATA[
Hey, thanks for your reply aswell!<br>I'm good on this issue now. Thanks alot tho!! <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=12042">Nash</a> — Fri Aug 03, 2012 8:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[doggo]]></name></author>
		<updated>2012-07-31T18:16:42-04:00</updated>

		<published>2012-07-31T18:16:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99813#p99813</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99813#p99813"/>
		<title type="html"><![CDATA[[YouTitle] tcl error + small changes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99813#p99813"><![CDATA[
try this, i made it a while ago for the bot in my websites irc channel, i hate clicking links when i dont know what the content will be! it should do everything you said you wanted already.. if not its easy enough to change a few bits here and there <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> <br><br>heres what it looks like <a href="http://i.imgur.com/FQRHu.png" class="postlink">http://i.imgur.com/FQRHu.png</a><br><div class="codebox"><p>Code: </p><pre><code># youtube.tcl # by doggo #omgwtfnzbs@EFNET ######################### package require httpbind pubm -|- * youtube:match proc youtube:match {nick uhost hand chan text} { if {[regexp -nocase {http://.*youtube.com/watch\?(.*)v=([A-Za-z0-9_\-]+)} $text match fluff youtubeid]} {} elseif {[regexp -nocase {http://.*youtu.be/([A-Za-z0-9_\-]+)} $text match youtubeid]} {} else { return }set youtube_query "http://www.youtube.com/watch?v=$youtubeid"set html [youtube:getdata $youtube_query]regexp -nocase {&lt;meta name="title" content="(.*?)"&gt;} $html match title regexp -nocase {&lt;span class="watch-view-count"&gt;.*?&lt;strong&gt;(.*?)&lt;/strong&gt;} $html match viewsregexp -nocase {&lt;span class="likes"&gt;(.*?)&lt;/span&gt; likes, &lt;span class="dislikes"&gt;(.*?)&lt;/span&gt;} $html match likes dislikesregexp -nocase {&lt;span class="comments-section-stat"&gt;\((.*?)\)&lt;/span&gt;} $html match commentsregexp {"length_seconds": ([0-9]+),} $html match lengthset title [youtube:htmlcodes $title]if {$title==0} {return}if {$length &gt; 3600} {set length [clock format $length -format %H:%M:%S]} else {set length [clock format $length -format %M:%S]}if {$comments == 1} {set com "comment"} else {set com "comments"}set logo "\002\0031,00 You\0031,00 \00300,04 Tube \00300,04\003\002\00314"set views "($views views)"set likes "$likes likes,"set dislikes "$dislikes dislikes"set comments "&amp; $comments $com"puthelp "privmsg $chan :$logo \"$title\" $length $views $likes $dislikes $comments"}proc youtube:getdata {data} {::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 $data -timeout 5000]set html [::http::data $url]::http::cleanup $htmlreturn $html}# borrowed from an old imdb scriptproc youtube:htmlcodes {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]]} contentregsub -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 Jul 31, 2012 6:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nash]]></name></author>
		<updated>2012-07-31T00:05:30-04:00</updated>

		<published>2012-07-31T00:05:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99806#p99806</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99806#p99806"/>
		<title type="html"><![CDATA[[YouTitle] tcl error + small changes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99806#p99806"><![CDATA[
Hey McGuyver, thanks for the tip! It worked! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>Any idea on the 2.) maybe? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12042">Nash</a> — Tue Jul 31, 2012 12:05 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[McGuyver]]></name></author>
		<updated>2012-07-30T19:52:17-04:00</updated>

		<published>2012-07-30T19:52:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99805#p99805</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99805#p99805"/>
		<title type="html"><![CDATA[[YouTitle] tcl error + small changes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99805#p99805"><![CDATA[
I suggest adding <div class="codebox"><p>Code: </p><pre><code>set youtubeid ""</code></pre></div> right under the "proc mu" line<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11771">McGuyver</a> — Mon Jul 30, 2012 7:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nash]]></name></author>
		<updated>2012-07-30T17:37:42-04:00</updated>

		<published>2012-07-30T17:37:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99804#p99804</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99804#p99804"/>
		<title type="html"><![CDATA[[YouTitle] tcl error + small changes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99804#p99804"><![CDATA[
Greetings <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>I've found this youtube script and it's working pretty well so far:<div class="codebox"><p>Code: </p><pre><code>package require http 2.4bind PUBM - * muproc mu {nick uhost hand chan text} {set web(page) http://www.youtube.comset watch [regexp -nocase -- {\/watch\?v\=([^\s]{11})} $text youtubeid]if { $watch == 0 } {set watch [regexp -nocase -- {youtu\.be\/([^\s]{11})} $text a youtubeid]set youtubeid "/watch?v=$youtubeid"}set logoo "\002\00301,00You\00300,04Tube\002\017" if {$watch &amp;&amp; $youtubeid != ""} {putlog "$web(page)$youtubeid"set agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"     set t [::http::config -useragent $agent]set t [::http::geturl "$web(page)$youtubeid" -timeout 30000]set data [::http::data $t]::http::cleanup $t set l [regexp -all -inline -- {&lt;meta name="title" content="(.*?)"&gt;.*?&lt;span class="watch-view-count"&gt;.*?&lt;strong&gt;(.*?)&lt;/strong&gt;} $data] regexp {"length_seconds": (\d+),} $data "" length foreach {black a b c d e} $l { set a [string map -nocase {\&amp;\#39; \x27 &amp; \x26 " \x22} $a]set b [string map [list \n ""] $b]set c [string map [list \n ""] $c]set d [string map [list \n ""] $d]set e [string map -nocase {\&amp;\#39; \x27 &amp; \x26 " \x22} $e] regsub -all {&lt;.*?&gt;} $a {} aregsub -all {&lt;.*?&gt;} $b {} bregsub -all {&lt;.*?&gt;} $c {} cregsub -all {&lt;.*?&gt;} $d {} dregsub -all {&lt;.*?&gt;} $e {} e #putserv "PRIVMSG $chan :YouTube: $a ( [duration $length] ) Viewed $b"putserv "PRIVMSG $chan :YouTube: $a - Duration: [duration $length] - Views: $b"     proc duration {s} {variable etubeset hours [expr {$s / 3600}]set minutes [expr {($s / 60) % 60}]set seconds [expr {$s % 60}]set res "" if {$hours != 0} {append res "$hours hours"}if {$minutes != 0} {append res " $minutes minutes"}if {$seconds != 0} {append res " $seconds seconds"}return $res}}}} putlog "_____ YouTitle loaded..."</code></pre></div>However, when it's loaded it gives me this error message in the partyline:<br>"Tcl error [mu]: can't read "youtubeid": no such variable"<br>The script works so far, but i would like to get rid off this error message.<br>EDIT: it appears that this error msg comes up everytime someone writes something in the channel. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_eek.gif" width="15" height="15" alt=":shock:" title="Shocked"> <br><br>Also, currently the script displays the youtube info like this:<br>YouTube: Bill Hicks salvation (FULL) - Duration: 1 hour 54 minutes 36 seconds - Views: 34.405<br><br>1.) Would it be possible to change the format of the duration to 1:54:36 or something simliar?<br>2.) Would it be possible to add likes /dislikes / author to the script?<br><br><br>Disclaimer: i've absolutely zero scripting knowledge so adding this by myself is practially impossible.<br>All i can do really is change the appearance  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> <br><br><br>Anyways, i'm highly grateful for every help i can get!!<br>Thanks in advance! <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=12042">Nash</a> — Mon Jul 30, 2012 5:37 pm</p><hr />
]]></content>
	</entry>
	</feed>
