The script will fetch the embed code for that link and write to a .html file
Let me show you what I mean, if you go to http://www.youtube.com/watch?v=lKpMePk- ... ure=g-vrec
and click on 'Share' you can click on a 'Embed' button that will write you the code I need to write to a html file so it will embed the link.
I want to embed youtube videos posted in the channel to a .html file
# 16/06/2012
# by doggo #omgwtfnzbs @ EFNET
# youtube_html.tcl
#########################################################
bind pubm -|- "% *http://*youtube*" youtube_html
#file must exist or you will get an error!
set fname "/var/www/youtube.html"
proc youtube_html {nick userhost handle channel args} {
global fname
#edit at own risk!
if {[regexp -nocase -- {http://.*youtube.com/watch\?(.*)v=([A-Za-z0-9_\-]+)} $args match fluff video_id]} {
#check if its allready in the file
set file [open $fname r]
set data [read $file]
close $file
foreach line [split $data \n] {
if { [string match -nocase "*$video_id*" "$line"] == 1 } {
catch {unset data}
#stops the video being added again
putlog "youtube link exists.";return
}
}
#not in the file? then we will add it
set tformat "%a, %d %b %Y @ %r"
set date [clock format [clock seconds] -format $tformat]
set fp [open $fname "a"]
set line_to_add "<center><strong>$nick $channel $date</strong><br /><iframe class=\"youtube-player\" width=\"1000\" height=\"500\" src=\"http://www.youtube.com/v/$video_id\" frameborder=\"0\" allowfullscreen></iframe></center><br /><br />"
puts $fp $line_to_add
close $fp
}
}