;Youtube URL logger ;finds info about a youtube video and logs it to @YouTube and writes to youtube.txt ;info it finds about a single video: title, description, ratngs, view count, # of comments, times favorited ;youtube video search ;returns the first search result for your search terms ;triggers: !youtube @youtube !tube @tube ;syntax: @youtube ; youtube URL logger ; finds info about a youtube video and logs it to @YouTube and writes to youtube.txt ; info it finds about a single video: title, description, ratngs, view count, # of comments, times favorited on *:text:*youtube.com/watch?v=*:*:{ %rating = 0 %entry = $1- if %tube != on { window @YouTube set %tube on echo @YouTube •›› Info: YouTube window opened $day $+ , $date $+ , $time } if (http:// isin $1-) %ytpath = / $+ $gettok($gettok($1-,3,47),1,38) else %ytpath = / $+ $gettok($gettok($1-,2,47),1,38) %ytnick = $nick %ytchan = $chan sockclose yt sockopen yt youtube.com 80 } on *:close:@YouTube:{ set %tube off } on *:sockopen:yt:{ if ($sockerr) { echo -a $chr(91) $+ $time $+ $chr(93) YouTube: socket error if (%ytchan) { echo @YouTube ................................................................................................................................................................................................................................................................................................... echo @YouTube ERROR: < $+ $date $+ > < $+ $time $+ > < $+ $network %ytchan $+ > < $+ %ytnick $+ > %entry write yterror.txt < $+ $date $+ > < $+ $time $+ > < $+ $network %ytchan $+ > < $+ %ytnick $+ > %entry } if (%ytchan == $null && %ytnick != $null) { echo @YouTube ................................................................................................................................................................................................................................................................................................... echo @YouTube ERROR: < $+ $date $+ > < $+ $time $+ > < $+ $network PM $+ > < $+ %ytnick $+ > %entry write yterror.txt < $+ $date $+ > < $+ $time $+ > < $+ $network PM $+ > < $+ %ytnick $+ > %entry } halt } sockwrite -n $sockname GET %ytpath HTTP/1.1 sockwrite -n $sockname Host: youtube.com sockwrite -n $sockname $crlf } on *:sockread:yt: { :read sockread -f %ytread if (Ratings have been disabled for this video isin %ytread) { set %ratingsdisabled yes } if (Adding comments have been disabled for this video isin %ytread) { set %commentsdisabled yes } if ( isin %ytread) { %numratings = $remove(%ytread, ,
,ratings, ,
) } if (Views: isin %ytread) { %views = $remove(%ytread, ,,,
,|
, ,Views:) } if (Comments: isin %ytread) { %comments = $remove(%ytread, ,,,
,|
, ,Comments:) } if (Favorited: isin %ytread) { %favorited = $remove(%ytread, ,,,
,|
, ,Favorited:) } if ( isin %ytread) %title = $remove(%ytread, ,<title>YouTube - ,) if (%found) { unset %found | %desc_be = $remove(%ytread, ) } if ( isin %ytread) %found = k if ( isin %ytread) %desc_re = $replace($remove(%ytread, ,,),
,$chr(32)) if (Category  isin %ytread) %done = k if (%done) { sockclose yt unset %done :title if (%ytchan) { echo @YouTube ................................................................................................................................................................................................................................................................................................... echo @YouTube 4•›››››››› 4< $asctime(mm:dd:yyyy-HH:nn:ss) $+ 4> 4< $network %ytchan $+ 4> 4< $+ %ytnick $+ 4> %entry echo @YouTube Title: %title write youtube.txt ..................................................................................................................................................................................................................................................................... write youtube.txt < $+ $date $+ > < $+ $time $+ > < $+ $network %ytchan $+ > < $+ %ytnick $+ > %entry write youtube.txt Title: %title if (%ratingsdisabled == yes && %commentsdisabled == yes) { echo @YouTube Rating: %rating stars 4(Disabled). Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars (Disabled). Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } if (%commentsdisabled == yes && %ratingsdisabled = $null) { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } else { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. goto desc } } if (%ytchan == $null && %ytnick != $null) { echo @YouTube ................................................................................................................................................................................................................................................................................................... echo @YouTube 4•›››››››› 4< $asctime(mm:dd:yyyy-HH:nn:ss) $+ 4> 4< $network PM $+ 4> 4< $+ %ytnick $+ 4> %entry echo @YouTube Title: %title write youtube.txt ..................................................................................................................................................................................................................................................................... write youtube.txt < $+ $date $+ > < $+ $time $+ > < $+ $network PM $+ > < $+ %ytnick $+ > %entry write youtube.txt Title: %title if (%ratingsdisabled == yes && %commentsdisabled == yes) { echo @YouTube Rating: %rating stars 4(Disabled). Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars (Disabled). Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } if (%commentsdisabled == yes && %ratingsdisabled = $null) { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } else { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. goto desc } } :desc if (%desc_re) { echo @YouTube Description: %desc_re write youtube.txt Description: %desc_re } else { echo @YouTube Description: %desc_be write youtube.txt Description: %desc_be } unset %entry unset %ytpath unset %ytnick unset %ytchan unset %title unset %ytread unset %desc_be unset %desc_re unset %rating unset %views unset %comments unset %favorited unset %numratings unset %ratingsdisabled unset %commentsdisabled } if ($sockbr) goto read } ; youtube video search ; returns the first search result for your search terms ; ; triggers: !youtube @youtube !tube @tube ; syntax: @youtube . ; example: !tube charleston daft punk 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,/]+>(.+?)/,\1),
,,, ) 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 (* isin %ytread) { %numratings = $remove(%ytread, ,
,ratings, ,
) } if (Views: isin %ytread) { %views = $remove(%ytread, ,,,
,|
, ,Views:) } if (Comments: isin %ytread) { %comments = $remove(%ytread, ,,,
,|
, ,Comments:) } if (Favorited: isin %ytread) { %favorited = $remove(%ytread, ,,,
,|
, ,Favorited:) } if ( isin %ytread) %title = $remove(%ytread, ,<title>YouTube - ,) if (%found) { unset %found | %desc_be = $remove(%ytread, ) } if ( isin %ytread) %found = k if ( isin %ytread) %desc_re = $replace($remove(%ytread, ,,),
,$chr(32)) if (Category  isin %ytread) %done = k if (%done) { sockclose yt unset %done :title if (%ytchan) { echo @YouTube ................................................................................................................................................................................................................................................................................................... echo @YouTube 4•›››››››› 4< $asctime(mm:dd:yyyy-HH:nn:ss) $+ 4> 4< $network %ytchan $+ 4> 4< $+ %ytnick $+ 4> %entry echo @YouTube Title: %title write youtube.txt ..................................................................................................................................................................................................................................................................... write youtube.txt < $+ $date $+ > < $+ $time $+ > < $+ $network %ytchan $+ > < $+ %ytnick $+ > %entry write youtube.txt Title: %title if (%ratingsdisabled == yes && %commentsdisabled == yes) { echo @YouTube Rating: %rating stars 4(Disabled). Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars (Disabled). Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } if (%commentsdisabled == yes && %ratingsdisabled = $null) { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } else { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. goto desc } } if (%ytchan == $null && %ytnick != $null) { echo @YouTube ................................................................................................................................................................................................................................................................................................... echo @YouTube 4•›››››››› 4< $asctime(mm:dd:yyyy-HH:nn:ss) $+ 4> 4< $network PM $+ 4> 4< $+ %ytnick $+ 4> %entry echo @YouTube Title: %title write youtube.txt ..................................................................................................................................................................................................................................................................... write youtube.txt < $+ $date $+ > < $+ $time $+ > < $+ $network PM $+ > < $+ %ytnick $+ > %entry write youtube.txt Title: %title if (%ratingsdisabled == yes && %commentsdisabled == yes) { echo @YouTube Rating: %rating stars 4(Disabled). Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars (Disabled). Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } if (%commentsdisabled == yes && %ratingsdisabled = $null) { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments 4(Disabled). Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments (Disabled). Favorited: %favorited times. goto desc } else { echo @YouTube Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. write youtube.txt Rating: %rating stars. Rated: %numratings times. Views: %views $+ . Comments: %comments $+ . Favorited: %favorited times. goto desc } } :desc if (%desc_re) { echo @YouTube Description: %desc_re write youtube.txt Description: %desc_re } else { echo @YouTube Description: %desc_be write youtube.txt Description: %desc_be } unset %entry unset %ytpath unset %ytnick unset %ytchan unset %title unset %ytread unset %desc_be unset %desc_re unset %rating unset %views unset %comments unset %favorited unset %numratings unset %ratingsdisabled unset %commentsdisabled } if ($sockbr) goto read } ; youtube video search ; returns the first search result for your search terms ; ; triggers: !youtube @youtube !tube @tube ; syntax: @youtube ]+>(.+?)
/,\1),
, ) 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 (*