tglogo.png

Downloading File

Filename: YouTube Video Searcher
;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*;
;           YouTube Video Searcher               ;
;            Made by MountainDew                 ;
;       IRC.DeltaAnime.net � #Lindrian           ;
;        IRC.UnderNet.org � #Hawkee.com          ;
;           IRC.SwiftIRC.net � #mSL              ;
;*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~;

on $*:text:/^[!@.](y(ou)?tube|yt)\b/Si:#:{
  youtube $+($ticks,$chr(1),$chan,$chr(1),$2-)
}
alias youtube {
  if ($numtok($1-,1) >= 2) {
    tokenize 1 $1-
    var %y.sock $1
    var %y.chan $2
    var %y.text $3-
  }
  else {
    var %y.sock $ticks
    var %y.text $1-
  }
  if (!%y.text) {
    $iif(%y.chan,msg $v1,echo -a) Syntax: $iif(%y.chan,!,/) $+ YouTube [search criteria]
    halt
  }
  $iif(%y.chan,describe $v1 searches,echo -a Searching) for YouTube videos matching $qt($+(,%y.text,)) $+ ...
  sockopen youtube. [ $+ [ %y.sock ] ] www.youtube.com 80
  sockmark youtube. [ $+ [ %y.sock ] ] $+($iif(%y.chan,msg $v1,echo -a),$chr(1),%y.text)
}
on *:SOCKOPEN:youtube.*: {
  sockwrite -nt $sockname GET /results?search_query= $+ $urlencode($gsm($sockname,2,1)) HTTP/1.1
  sockwrite -nt $sockname Host: www.youtube.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:youtube.*: {
  if ($sockerr) {
    $gsm($sockname,1,1) Error connecting to YouTube: $sock($sockname).wmsg
    sockclose $sockname
  }
  else {
    var %x. [ $+ [ $sockname ] ]
    sockread %x. [ $+ [ $sockname ] ]
    if ($regex(%x. [ $+ [ $sockname ] ],/No Videos found for <span >/i)) {
      $gsm($sockname,1,1) The search for $qt($+(,$gsm($sockname,2,1),)) returned no results.
      sockclose $sockname
    }
    if ($regex(%x. [ $+ [ $sockname ] ],/<a href="(\/watch\?v=[^"]+)" >/i)) addmark $sockname 1 http://www.youtube.com/ $+ $regml(1)
    if ($regex(%x. [ $+ [ $sockname ] ],/title="(.+)" alt="video"><\/a>/i)) addmark $sockname 1 $regml(1)
    if ($regex(%x. [ $+ [ $sockname ] ],/<\/span> (\d+ .+ ago)<br\/>/i)) addmark $sockname 1 $regml(1)
    if ($regex(%x. [ $+ [ $sockname ] ],/From:<\/span><span class="vlfrom"><a href="\/user\/.+" >(.+)<\/a><\/span><\/div>/i)) addmark $sockname 1 $regml(1)
    if ($regex(%x. [ $+ [ $sockname ] ],/Views:<\/span> (.+)<br\/>/i)) addmark $sockname 1 $regml(1)
    if ($regex(%x. [ $+ [ $sockname ] ],/<img class="ratingVS ratingVS-.+" alt="(.+)" src=/i)) addmark $sockname 1 $regml(1)
    if (</div> <!-- end search results --> isin %x. [ $+ [ $sockname ] ]) sockclose $sockname
    if ($regex(%x. [ $+ [ $sockname ] ],/"runtime">(.+)<\/div>/i)) {
      inc %n. [ $+ [ $sockname ] ]
      tokenize 1 $sock($sockname).mark
      $gsm($sockname,1,1) 9 $+ $chr(149) 4Title: $hf($4) 4Added: $5 4User: $hf($6) 4Length: $regml(1) 4Views: $7 4Rating: $iif($8,$8,0) $+ /5 4URL: $3
      if (%n. [ $+ [ $sockname ] ] >= 3) {
        sockclose $sockname
        unset %n. [ $+ [ $sockname ] ]
      }
      sockmark $sockname $gsm($sockname,1,1) $+ $chr(1) $+ $gsm($sockname,2,1)
    }
  }
}
alias hf return $remove($replace($1-,&quot;,",&gt;,>,&lt,<,&amp;,&,&nbsp;,$chr(160)),?,$chr(9))
alias gsm return $gettok($sock($1).mark,$2,$3)
alias addmark sockmark $1 $addtok($sock($1).mark,$3-,$2)
alias urlencode return $regsubex($1,/(\W)/gS,% $+ $base($asc(\1),10,16,2)))

Related Files

by FordLawnmower
by FordLawnmower
by Ford Lawnmower

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand