[J40k]Youtube Script

By J40k on Dec 22, 2006

Ok this is my first snippet thats of any use. All you have to do is copy this code to your remotes.
then type

!youtube "item to search on youtube"

also you can type

!tube "item to search on youtube"

and it will come out like.

!youtube Hello there
YouTube Search: Top Search Result
www.youtube.com/watch?v=vvnCRl2_VZk

the command has both ! and @ and only uses two lines so wont spam much.

on $*:TEXT:/^[!@](youtube|tube) */Si:#: { 
  set %chan.tube $chan
  if ($2 == $null) { halt }
  elseif (!* iswm $1) { set %tube.style /notice $nick }
  elseif (@* iswm $1) { set %tube.style /msg %chan.tube }
  set %tube.search $replace($2-,$chr(32),+)
  sockopen youtube www.youtube.com 80
  inc %ID
}

on *:sockopen:youtube:{
  sockwrite -nt $sockname GET /results?search_query= $+ %tube.search $+ &search=Search HTTP//1.1
  sockwrite -nt $sockname Host: youtube.com 
  sockwrite -nt $sockname $crlf $crlf 
}

on *:sockread:youtube:{
  var %temp
  sockread %temp
  if (%tube.line == 5) {
    set %tube.url $remove($gettok(%temp,2,32),href=",")
    %tube.style 14YouTube Search: Top Search Result
    %tube.style 4www.youtube.com $+ %tube.url
    unset %tube.url
    unset %tube.style
    unset %chan.tube
    unset %tube.search 
    unset %tube.line 
    sockclose youtube 
  }
  if (%tube.line == 4) { inc %tube.line }
  if (%tube.line == 3) { inc %tube.line }
  if (%tube.line == 2) { inc %tube.line }
  if (%tube.line == 1) { inc %tube.line }
  if ( *start search results* iswm %temp) { set %tube.line 1 }
}

Comments

Sign in to comment.
Mudkipz   -  Jan 20, 2008

this wont work mate, if u can get it to work send the new script as a pm please

 Respond  
Callison1   -  Jun 24, 2007

Actually in the code I posted
if (%tube.line < 7) { inc %tube.line }
should be
if (%tube.line != $null) && (%tube.line < 7) { inc %tube.line }

 Respond  
Callison1   -  Jun 23, 2007

I think the site has changed slightly, if you change
if (%tube.line == 5) {
to
if (%tube.line == 7) {
and change
if (%tube.line == 4) { inc %tube.line }
if (%tube.line == 3) { inc %tube.line }
if (%tube.line == 2) { inc %tube.line }
if (%tube.line == 1) { inc %tube.line }
to
if (%tube.line < 7) { inc %tube.line }
it works perfectly

 Respond  
greenlanter420   -  Feb 24, 2007

Youtube must have changed something because this no longer works.

 Respond  
Marshtomp   -  Dec 23, 2006

Just a problem...
\"Ok this is my first snippet thats of any use. All you have to do is copy this code to your remotes.
then type

!youtube \"item to search on youtube\"

also you can type

!tube \"item to search on youtube\"

and it will come out like.

!youtube Hello there
YouTube Search: Top Search Result
www.youtube.com/watch?v=vvnCRl2_VZk

the command has both ! and @ and only uses two lines so wont spam much.\"
This is unclear; you can\'t do !youtube\!tube yourself; you need to use a alias OR use a ON INPUT..

 Respond  
Sasuke   -  Dec 22, 2006

Very good! Very useful!

 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.