Why doesn't this work? - 01/02/15 12:39 AM
I've been messing around with this code and even tried adding regex but it just won't give me the length of the video
Code:
on *:TEXT:!yt &:#: { if ($sock(YTube)) .sockclose YTube set %link $2 sockopen -e YTube www.youtube.com 443 } on *:SOCKOPEN:YTube: { sockwrite -nt $sockname GET /watch?v= $+ %link HTTP/1.1 sockwrite -nt $sockname Host: www.youtube.com $+ $str($crlf,2) } on *:SOCKREAD:YTube: { if (!$sockerr) { var %sockreader | sockread %sockreader tokenize 32 %sockreader if ($regex(%sockreader,/"length_seconds":".+?"/)) { echo -a $1 unset %link sockclose YTube } } }