Here's a very crude version of the search feature you requested that can be added into your remotes. Personally I was just looking for a passive youtube url catcher instead of something that actively responds to requests.

Anyhow, it is triggered by !youtube @youtube !tube or @tube. It is based off the script as seen in http://www.hawkee.com/snippet.php?snippet_id=2197

syntax example : !youtube <search terms>
This will return the most related video to your search terms. If you want the script to return the video with the highest view count (which may or may not be related to your search terms at all), then you can replace the following line
Code:
sockwrite -nt $sockname GET /results?search_query= $+ %tube.search HTTP//1.1

with this line
Code:
sockwrite -nt $sockname GET /results?search_query= $+ %tube.search $+ &search_sort=video_view_count HTTP//1.1


Anyways, here is the full code smile

Code:
on $*:TEXT:/^[!@](youtube|tube) */Si:#: { 
  %linenumber = 0
  set %chan.tube $chan
  set %tube.style /msg %chan.tube
  set %tube.search $replace($2-,$chr(32),+)

  if ($2 == $null) { %tube.style Search could not be completed | halt }
  sockopen ytsearch www.youtube.com 80
}

on *:sockopen:ytsearch:{
  sockwrite -nt $sockname GET /results?search_query= $+ %tube.search HTTP//1.1
  ; if you want to sort search by VIEW COUNT, use this instead of the line above
  ; sockwrite -nt $sockname GET /results?search_query= $+ %tube.search $+ &search_sort=video_view_count HTTP//1.1

  sockwrite -nt $sockname Host: youtube.com 
  sockwrite -nt $sockname $crlf $crlf 
}

on *:sockread:ytsearch:{
  var %temp
  sockread %temp

  if (%searchres == 1) {
    %searchtitle = $remove($regsubex(%temp,/<a [^>]+>(.+?)</a>/,\1),<br/>,	)
    set %tube.url $remove($gettok(%temp,2,32),href=",")

    if (/watch?v= isin %tube.url) {
      %tube.style %searchtitle $+ : http://www.youtube.com $+ %tube.url

      unset %linenumber
      unset %tube.search
      unset %searchtitle
      unset %chan.tube
      unset %tube.style
      unset %searchres      
      unset %tube.url

      sockclose ytsearch
      halt
    }
  }
  if ( *start search results* iswm %temp) { set %searchres 0 }  
  if (*<a href="/watch?v=* iswm %temp) { inc %searchres }
  inc %linenumber
}

Last edited by iamdegenatron; 17/02/07 06:28 AM.