Advertisement
wollux

YouTube Title Finder (bot script)

Oct 19th, 2011
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.46 KB | None | 0 0
  1. alias xconnection { set %tmpx $remove($1,http://,youtube,.com,www.) | sockopen youtube youtube.com 80 }
  2. on *:SOCKOPEN:youtube:{
  3.   sockwrite -n $sockname GET %tmpx HTTP/1.1
  4.   sockwrite -n $sockname Host: www.youtube.com
  5.   sockwrite -n $sockname User-Agent: IRCSpider/mIRC $version
  6.   sockwrite -n $sockname Accept: *.*, */*
  7.   sockwrite -n $sockname Referer: $server
  8.   sockwrite -n $sockname Connection: Keep-Alive
  9.   sockwrite -n $sockname Content-Type: text/html
  10.   sockwrite -n $sockname $crlf
  11.  
  12. }
  13. on *:SOCKREAD:youtube:{
  14.   sockread %mirc.temp
  15.   tokenize 32 %mirc.temp
  16.   if (!$window(@YouTube)) { window -a @YouTube }
  17.   if ($1) { echo -g @YouTube $1- }
  18.   if (<meta name="title" content=" isin %mirc.temp) { set %youtube.title $remove(%mirc.temp,$chr(9),<meta name="title" content=",">) }
  19.   if (<strong class="watch-view-count">*</strong><br>views iswm %mirc.temp) { echo -ag $1- | set %youtube.views $remove($ifmatch,<strong class="watch-view-count">,</strong><br>views) }
  20.   if (%youtube.title) { msg %tmp.chan 01,0You0,4Tube4:14 %youtube.title $chr(124) Views - %youtube.views $chr(124) Popularity - %youtibe.likes / %youtube.dislikes $chr(124) | sockclose youtube }
  21. }
  22. on *:SOCKCLOSE:youtube:{ /noop }
  23. on *:TEXT:*:#:{
  24.   set %tmp.chan $chan
  25.   unset %d
  26.   var %str = $gettok($1-,0,32)
  27.   while (%str) {
  28.     var %link = $gettok($1-,%str,32)
  29.     if (youtube.com/watch?v= isin %link) { sockclose youtube | xconnection %link | clear @YouTube | halt }
  30.     dec %str
  31.   }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement