mrmr commented on a Page, YouTube URL "Detector" (v.8)  -  Nov 12, 2009
on *:sockread:youtube: {
  var %yt | sockread %yt

  if ($regex(%yt,/<h1 >(.+)<\/h1>/)) sockmark youtube $addmark(youtube,Title: $+(,$regml(1),),62)
  elseif ($regex(%yt,/"length_seconds": "(\d+)/) ) sockmark youtube $addmark(youtube,Duration: $+(,$duration($regml(1)),),62)
  elseif ($regex(%yt,/ratingL-(.+)"\stitle|"smallText">(.+)\sratings<\/span>/g)) sockmark youtube $addmark(youtube,$+($regml(1),>,$regml(2)),62)
  elseif ($regex(%yt,/"watch-view-count">(.+)<\/span>\svi/)) sockmark youtube $addmark(youtube,$regml(1),62)
  elseif ($regex(%yt,date">(.+)<\/span>)) sockmark youtube $addmark(youtube,$+($chr(40),uploaded on $regml(1),$chr(41)),62)
  elseif ($regex(%yt,<a\sclass="url"\shref="\/user\/(\w+)")) sockmark youtube $addmark(youtube,By: $+(,$regml(1),),62)
}

This should work at the time of NOW.
Be aware that in some country, due to youtube's localization, something could not work as intended ;) (learn it the hard way...eehhe)

ohhh, wanna add this too:

on *:INPUT:#: {
  if ($regex($1,http\:\/\/.*youtube.*\/watch\?v=(.{11})&?.*)) {
    if (!$sock(youtube)) {
      noop $regex($strip($1-),http:\/\/.*youtube.*\/watch\?v=(.{11})&?.*)
      sockopen youtube www.youtube.com 80 | sockmark youtube $+(#,>,$regml(1))
    }
  }
}

this should "catch" also input from you, parsing youtube links that you paste in any channel.

Note that I'm a scripting beginner...so don't mind my "bad" style

EDIT: typo in ratings regex

 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.