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 }
}
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
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..