Youtube Title Reader

By SplitFire on Jan 15, 2011

A simple snippet that detects Youtube URLs said in the channel and displays the video title.

; YouTube Title Reader
; by SplitFire

on ^*:TEXT:*:#: {
  if ($regex($strip($1-),/www\.youtube\.com\/(.+)/ig)) {
    var %t $ticks
    sockopen url. $+ %t www.youtube.com 80
    sockmark url. $+ %t # $regml(1) 
    halt
  }
}
on ^*:ACTION:*:#: {
  if ($regex($strip($1-),/www\.youtube\.com\/(.+)/ig)) {
    var %t $ticks
    sockopen url. $+ %t www.youtube.com 80
    sockmark url. $+ %t # $regml(1)
    halt
  }
}
on *:sockopen:url.*:{
  sockwrite -n $sockname GET / $+ $gettok($sock($sockname).mark,2,32) HTTP/1.0 
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname $crlf
}
on *:sockread:url.*:{
  var %ur 
  sockread %ur
  if (%2nd) {
    msg $gettok($sock($sockname).mark,1,32) [You0,4Tube] $right($remove(%ur,$chr(9)),-1)
    sockclose $sockname 
    unset %2nd
    halt
  }
  if (%1st) { 
    unset %1st
    set %2nd x
    halt
  }
  if (*<title> iswm %ur) {
    set %1st x
    halt
  }
}

Comments

Sign in to comment.
blackvenomm666   -  Apr 10, 2011

nice

FevLoad  -  May 19, 2015

not working for me ><"

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.