napa182 commented on a Page, Basic Youtube channel infomation  -  Apr 12, 2010

you can do it like this as well

on $*:text:/^@yt\s(\S+)$/iS:#:{
  if ($hget(yt)) hfree yt
  if ($sock(yt)) sockclose yt
  sockopen yt www.youtube.com 80
  sockmark yt msg # User: $regml(1)
}
on *:sockopen:yt: { 
  sockwrite -n $sockname GET $+(/,$gettok($sock(yt).mark,4,32)) HTTP/1.1 
  sockwrite -n $sockname Host: $+(www.youtube.com,$str($crlf,2)) 
} 
on *:sockread:yt: { 
  var %yt | sockread %yt
  if ($regex(%yt,/<html><head><title>404 (Not Found)<\/title>/)) { $gettok($sock(yt).mark,1-,32) $regml(1) | sockclose yt }
  if ($regex(%yt,/<div style=.+viewed_count">(.+)<\/div>/)) { hadd -m yt a $regml(1) }
  if ($regex(%yt,/<div style=.+last_login">(.+)<\/div>/)) { hadd -m yt b $regml(1) }
  if ($regex(%yt,/<div style=.+subscriber_count">(.+)<\/div>/)) { $gettok($sock(yt).mark,1-,32) Views: $hget(yt,a) Lasted logged in: $hget(yt,b) Subscribers: $regml(1) | sockclose yt }
}
 Respond  
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.