This is a snippet that fetches the first result when you search youtube for something.
Syntax: !Youtube texthere
I made this because of a request from a friend, and also since youtube made a new search layout its different, so the old youtube scripts dont work..
on *:text:!youtube*:#: {
if ($sock(youtube)) .sockclose youtube
set %Ychan $chan
set %youtubetext $2-
sockopen youtube youtube.com 80
}
on *:SOCKOPEN:youtube: {
sockwrite -nt $sockname GET /results?search_query= $+ %youtubetext $+ &search= HTTP/1.1
sockwrite -nt $sockname Host: youtube.com
sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:youtube: {
if ($sockerr) {
msg %chan Socket Error: $sockname $+ .
halt
}
else {
var %sockreader
sockread %sockreader
if (*newvtitlelink* iswm %sockreader) {
noop $regex(%sockreader,/href="(.*?)" rel=/Si)
set %youtube $regml(1)
msg %Ychan Link: www.youtube.com $+ %youtube
unset %Ychan
sockclose youtube
}
}
}
this was just working and now it's not