; youtube video search ; returns the first search result for your search terms ; usage for you ; ; trigger: /yt ; syntax: /yt ; example: /yt charleston daft punk ; usage for other people ; ; triggers: !youtube @youtube !tube @tube ; syntax: @youtube ; example: !tube charleston daft punk ; if you want to sort search by VIEW COUNT, use this line below ; sockwrite -nt $sockname GET /results?search_sort=video_view_count&search_query= $+ %searchstring ; ; if you want the regular search, use this line below ; sockwrite -nt $sockname GET /results?search_query= $+ %searchstring HTTP//1.1 ; ; the place im referring to is: under the heading on *:sockopen:ytsearch:{ alias yt { %channel = $chan if (%channel) { %saystyle = echo -t %channel } else { %saystyle = echo -at } %searchstring = $replace($1-,$chr(32),+) sockclose ytsearch sockopen ytsearch www.youtube.com 80 } on $*:TEXT:/^[!@](yt|youtube|tube) */Si:#: { %channel = $chan %saystyle = /msg %channel %searchstring = $replace($2-,$chr(32),+) if ($2 == $null) { %saystyle Search could not be completed | halt } sockclose ytsearch sockopen ytsearch www.youtube.com 80 } on *:sockopen:ytsearch:{ sockwrite -nt $sockname GET /results?search_query= $+ %searchstring HTTP//1.1 sockwrite -nt $sockname Host: youtube.com sockwrite -nt $sockname $crlf $crlf } on *:sockread:ytsearch:{ sockread -n %temp if (%founddesc_be) { unset %founddesc_be | %desc_be = $replace($remove(%temp, ),
,$chr(32)) } if (]+>(.+?)/,\1),
, ),",$chr(34)) } if (
isin %temp) { %foundtitle = k | %titlecounter = 0 } if (