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

	<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>2016-06-25T14:34:00-04:00</updated>

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

		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2016-06-25T14:34:00-04:00</updated>

		<published>2016-06-25T14:34:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105213#p105213</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105213#p105213"/>
		<title type="html"><![CDATA[Help with youtube-title script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105213#p105213"><![CDATA[
That's mostly cos the regexp is failing to match the link with the given pattern (the one you set at <em class="text-italics">youtube(pattern)</em>) most likely cos of the secured SSL connection, meaning having https rather than http, so try with replacing that with:<div class="codebox"><p>Code: </p><pre><code>set youtube(pattern) (?:\/watch\?v=|youtu\.be\/)([\d\w-]{11})</code></pre></div>The best regexp I could find is <a href="https://github.com/regexhq/youtube-regex" class="postlink">this JavaScript</a> version that seems to match multiple possible URL's, but I'm not a regexp genius (or too tiered at elast) to <em class="text-italics">adjust</em> it in TCL.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Sat Jun 25, 2016 2:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[XtremeSeb]]></name></author>
		<updated>2016-06-21T17:38:16-04:00</updated>

		<published>2016-06-21T17:38:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105205#p105205</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105205#p105205"/>
		<title type="html"><![CDATA[Help with youtube-title script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105205#p105205"><![CDATA[
I have this script but doesnt show anything when i paste a youtube url. No title, no error, nothing. What could be the problem?<div class="codebox"><p>Code: </p><pre><code># 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/oembed"# 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 $httpfor {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 valueset kvmode 0set cl 0set i 1set 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 1set start [expr $i + 1]} elseif { $kvmode == 1 } {set kvmode 2set name [string range $json_blob $start [expr $i - 1]]} elseif { $kvmode == 2 } {set kvmode 3set start [expr $i + 1]} elseif { $kvmode == 3 } {set kvmode 0set info_array($name) [string range $json_blob $start [expr $i - 1]]}}set cl $cincr i 1}}proc filter_title {blob} {# Try and convert escaped unicodeset blob [subst -nocommands -novariables $blob]set blob [string trim $blob]set blob}proc extract_title {json_blob} {global youtubearray set info_array {}flat_json_decoder info_array $json_blobif { [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 youtubeif { $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 stateforeach {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 $responsereturn [extract_title $response_body]}}proc public_youtube {nick userhost handle channel args} {global youtube botnickif {[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 $matchif { $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"}}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12630">XtremeSeb</a> — Tue Jun 21, 2016 5:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
