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

	<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>2011-03-21T10:21:30-04:00</updated>

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

		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2011-03-21T10:21:30-04:00</updated>

		<published>2011-03-21T10:21:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96508#p96508</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96508#p96508"/>
		<title type="html"><![CDATA[youtube tcl with protection]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96508#p96508"><![CDATA[
Give this a try.<br><div class="codebox"><p>Code: </p><pre><code># youtitle.tcl# to function in #channelname requires in the partyline .chanset #channelname +youtitle# requires that coloured text can be displayed in #channelname (eg. not +c on DALnet) ############################################################################################################# configuration ########################################################################### set here the minimum time in seconds that must elapse before another channel input is parsedset vYoutitleThrottleTime 5# set here a list of words considered forbidden in YouTube video titlesset vYoutitleForbidden {    dead    sex}########## end of configuration ######################################################################################################################################################################set vYoutitleVersion 11.03.20.17.47package require httpsetudef flag youtitleset vYoutitleThrottled 0bind PUBM - * pYoutitleTriggerproc pYoutitleTrigger {nick uhost hand chan text} {    global vYoutitleThrottled vYoutitleThrottleTime    if {[channel get $chan youtitle]} {        if {!$vYoutitleThrottled} {            set vYoutitleThrottled 1            utimer $vYoutitleThrottleTime pYoutitleRelease            if {[regexp -nocase -- {youtube\.com/watch\?v\=([^\s]{11})} $text -&gt; link]} {                pYoutitleParse $nick $chan $link            }        }    }    return 0}proc pYoutitleParse {nick chan link} {    global vYoutitleForbidden    set url http://www.youtube.com/watch?v=$link    set agent [::http::config -useragent "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"]    if {![catch {set token [::http::geturl $url -timeout 10000]}]} {        switch -- [::http::status $token] {            ok {                switch -- [::http::ncode $token] {                    200 {                        set data [::http::data $token]                        regexp -nocase -- {&lt;span id=\"eow-title\"[^&gt;]+&gt;([^&lt;]+)&lt;/span&gt;} $data -&gt; title                        if {[info exists title]} {                            set title [regsub -all -- {[\t\n]} $title ""]                            set title [regsub -all -- {\:} $title " - "]                            set title [string trim [regsub -all -- {[\s]{2,}} $title " "]]                            set title [string map -nocase {\&amp;\#39; \x27 &amp; \x26 " \x22} $title]                            foreach word $vYoutitleForbidden {                                if {[regexp -nocase -- [subst -nobackslashes {(\A|\s)${word}(\s|\Z)}] $title]} {                                    putserv "NOTICE $nick :forbidden word(s) detected in the title of your YouTube link"                                    return 0                                }                            }                            set page You\00300,04Tube\003                            putserv "PRIVMSG $chan :$page $title"                        } else {}                    }                    default {}                }            }            default {}        }        ::http::cleanup $token    }    return 0}proc pYoutitleRelease {} {    global vYoutitleThrottled    set vYoutitleThrottled 0    return 0}putlog "youtitle.tcl version $vYoutitleVersion loaded"# eof</code></pre></div>** edited 21/03/11 14:14pm to translate html ampersands **<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Mon Mar 21, 2011 10:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Cr0ntab]]></name></author>
		<updated>2011-03-19T03:45:55-04:00</updated>

		<published>2011-03-19T03:45:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96495#p96495</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96495#p96495"/>
		<title type="html"><![CDATA[youtube tcl with protection]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96495#p96495"><![CDATA[
Hello. i would like a tcl that shows the artist and title of a youtube link when it is posted to a channel but with 2 main protections:<br>1. flood protection with limiting 1 link per 4-5sec<br>2. a protection that if the title has one of the words i set in the tcl the title is NOT shown in the channel and the user gets a notice that the title of the Youtube videoo has a forbidden word in it<br><br>Thank you<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11149">Cr0ntab</a> — Sat Mar 19, 2011 3:45 am</p><hr />
]]></content>
	</entry>
	</feed>
