hello,
i have this script by Ford_Lawnmower
https://pastee.org/ht3t7
how to add youtube video duration time spec into it ?
thank you.
Code: Select all
set youtubeduration ""
if {[regexp -nocase {<meta itemprop=\"duration\" content=\"(.*?)\">.*} $youtubevar match youtubeduration]} {
set youtubeduration "Duration: $youtubeduration"
set youtubeduration [string map [list {PT} {} {M} {:} {S} {}] $youtubeduration]
}
Code: Select all
if {[regexp -nocase {<meta itemprop=\"duration\" content=\"(.*?)\">.*} $youtubevar match youtubeduration]} {
set youtubelength $youtubeduration
if {[regexp {M(.*?)S} $youtubevar match youtubeduration]} {
set videosecs $youtubeduration
}
set youtubeduration $youtubelength
if {[regexp {PT(.*?)M} $youtubevar match youtubeduration]} {
set videomins $youtubeduration
}
set totalseconds [expr {($videomins * 60) + $videosecs}]
set youtubeduration [clock format $totalseconds -format {%H:%M:%S}]
}
Code: Select all
if {[regexp -nocase {<meta itemprop=\"duration\" content=\"(.*?)\">.*} $data match duration]} {
set youtubelength $duration
if {[regexp {M(.*?)S} $duration match duration]} {
set videosecs $duration
}
set duration $youtubelength
if {[regexp {PT(.*?)M} $duration match duration]} {
set videomins $duration
}
set totalseconds [expr {($videomins * 60) + $videosecs}]
set duration [clock format $totalseconds -format {%H:%M:%S}]
}
regarding to WazzUK posted, i got this error when i tried to run it on my eggdrop. i've try this tcl but it keeps telling me that there's an error with the script. here what i got:WazzaUK wrote:http://forum.egghelp.org/viewtopic.php?t=19596
Code: Select all
can't read "maxlen": no such variable
while executing
"string is integer -strict $maxlen"
invoked from within
"if {[string is integer -strict $maxlen]} {
if {($maxlen == "") || ($maxlen < 1)} {set maxlen 100}
} else { set maxlen "100" }"
(file "scripts/you.tcl" line 50)