Aktuelle Zeit: 16. April 2024 21:26

Alle Zeiten sind UTC + 1 Stunde




 Seite 1 von 1 [ 2 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: YouTube Infos
BeitragVerfasst: 11. Juni 2010 19:49 
Administrator
Benutzeravatar

Registriert: 17. März 2008 13:32
Beiträge: 96
Wohnort: NRW, Germany
Requires $download

; Requires the $download snippet can be found here: http://sephiroth.bounceme.net/forum/viewtopic.php?t=104
; No need to change anything normally
; Simply paste it to remote and you will get an echo after someone pasted a youtube uri
; if you wanna use it for a bot change the post alias to return $true
;
; Update: 21.01.2012
;  - added some errorchecking
;  - changed Wildmatch
;  - better parsing
;  - added youtu.be-links
alias -l post { return $false }
on *:text:*youtube*v=*:*: {
  var %url = $wildtok($1-,*youtube.com/*v=*, 1, 32)
  if ($youtube(%url)) {
    tokenize 9 $ifmatch
    ; Author -> $1
    ; Duration -> $2
    ; Rating -> $3
    ; Date (last updated OR published) -> $4
    ; Preview Picture -> $5
    ; Title -> $6
    $iif($post,msg,echo $color(info)) $iif($chan,$chan,$nick) 1,15You0,4Tube: $6 (Rating: $3 $+ ) from: $1 Date: $4 Duration: $2 Preview: $5
  }
}
on *:text:*youtu.be*:*:{
  var %url = $wildtok($1-,http://youtu.be/*, 1, 32)
  if ($len(%url)) {
    %url = /?v= $+ $gettok(%url,3,47)
    if ($youtube(%url)) {
      tokenize 9 $ifmatch
      $iif($post,msg,echo $color(info)) $iif($chan,$chan,$nick) 1,15You0,4Tube: $6 (Rating: $3 $+ ) from: $1 Date: $4 Duration: $2 Preview: $5
    }
  }
}
alias youtube {
  ; http://www.youtube.com/watch?v=B0fFDk2M0zE&feature=fvhl#cookie
  ; example: $youtube(...youtube.com/watch?v=vid)
  var %x = $gettok($1-,1,35) , %o = $null, %r = $null, %y = 0
  %x = $gettok(%x,2-,63)
  %y = $numtok(%x,38)
  while (%y) {
    %o = $gettok(%x,%y,38)
    if ($gettok(%o,1,61) == v) { %r = $gettok(%o,2,61) }
    dec %y
  }
  if (!$len(%r)) { return $false }
  else { %x = %r }
  if ($download(tmpfile,GET,http://gdata.youtube.com/feeds/api/videos/ $+ %x ,2)) {
    bread tmpfile 0 $lof(tmpfile) &bin
    var %string = $b(&bin,<author>)
    if ($regex(%string,/\<author\>\<name\>(.*)\<\/name\>/ig)) { var %author = $regml(1) }
    var %string = $b(&bin,<yt:duration)
    if ($regex(%string,/\<yt:duration seconds='([\d]+)'\/\>/ig)) { var %duration = $duration($regml(1),3) }
    var %string = $b(&bin,<gd:rating)
    if ($regex(%string,/average='([^']+)' max='([\d]+)'/ig)) { var %rating = $round($regml(1),3) }
    var %string = $b(&bin,<title)
    if ($regex(%string,/type='text'>([^<]+)/ig)) { var %title = $regml(1) }
    var %string = $b(&bin,<updated>)
    if ($regex(%string,/\<updated>([\d]{4})-([\d]{2})-([\d]{2})T([\d]{2}:[\d]{2})\:/ig)) { var %date = $regml(3) $+ . $+ $regml(2) $+ . $+ $regml(1) $regml(4) }
    else {
      var %string = $b(&bin,<published>)
      if ($regex(%string,/\<published>([\d]{4})-([\d]{2})-([\d]{2})T([\d]{2}:[\d]{2})\:/ig)) { var %date = $regml(3) $+ . $+ $regml(2) $+ . $+ $regml(1) $regml(4) }
    }
    var %preview = http://i.ytimg.com/vi/ $+ %x $+ /0.jpg
    if ($isfile(tmpfile)) { !.remove tmpfile }
    if (!$len(%author)) var %author = n/a
    if (!$len(%duration)) var %duration = 00:00:00
    if (!$len(%date)) var %date = n/a
    if (!$len(%preview)) var %preview = n/a
    if (!$len(%title)) var %title = n/a
    if (!$len(%rating)) var %rating = n/a
    %x = $t(%author,%duration,%rating,%date,%preview,%title)
  }
  else { var %x = $false }
  if ($isfile(tmpfile)) { !.remove tmpfile }
  return %x
}
alias -l t { var %x = $0,%o | while (%x) { %o = $ [ $+ [ %x ] ] $+ $chr(9) $+ %o | dec %x } | return %o }
alias -l b { return $bvar($1,$bfind($1,1,$2).text,$iif($version > 6.31,4000,800)).text }



_________________
one step closer to world domination
Cyberscripters Administrator/Founder
   
 
 Betreff des Beitrags: Re: YouTube Infos
BeitragVerfasst: 12. Juni 2010 09:40 
Moderator

Registriert: 11. Juni 2010 16:53
Beiträge: 1
Dank dir seph. :)


   
 
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
 Seite 1 von 1 [ 2 Beiträge ] 

Alle Zeiten sind UTC + 1 Stunde


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  

cron