r00t-err0r

Eggdrop YouTube by munZe (TCL8.4)

Apr 27th, 2013
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.37 KB | None | 0 0
  1. bind pubm - *youtu.be/* YouTube
  2. bind pubm - *youtube.com/watch*v=* YouTube
  3. proc YouTube {nick host hand chan text} {
  4. set ytid [regexp -all -inline -nocase {([A-Za-z0-9_-]{11})} $text]; set ytid [lindex $ytid 0]
  5. set url "http://gdata.youtube.com/feeds/api/videos/$ytid?v=2&alt=jsonc&prettyprint=true"
  6. set token [ ::http::geturl $url ]; set page [ ::http::data $token ]
  7. ::http::cleanup $token
  8. set duration [regexp -all -inline {"duration": (.*?),} $page]; set duration [lindex $duration 1]; set duration [clock format $duration -gmt 1 -format %H:%M:%S]
  9. set title [regexp -all -inline {"title": "(.*?)",} $page]; set title [lindex $title 1]
  10. set likes [regexp -all -inline {"likeCount": "(.*?)",} $page]; set likes [lindex $likes 1]
  11. set views [regexp -all -inline {"viewCount": (.*?),} $page]; set views [lindex $views 1]
  12. set uploader [regexp -all -inline {"uploader": "(.*?)",} $page]; set uploader [lindex $uploader 1]
  13. #set uploaded [regexp -all -inline {"uploaded": "(.*?)",} $page]; set uploaded [lindex $uploaded 1]; set uploaded [clock scan $uploaded -format {%Y-%m-%dT%H:%M:%S.000Z}]; set uploaded [clock format $uploaded -format {%d.%m.%Y}]
  14. putserv "PRIVMSG $chan :Youtube - Title: \002$title\002 - Duration: \002$duration\002 - Likes: \002$likes\002 - Views: \002$views\002 - Uploaded by: \002$uploader\002"
  15. #- Uploaded: \002$uploaded\002"
  16. }
  17. putlog "Loaded YouTube TCL by munZe"
Advertisement
Add Comment
Please, Sign In to add comment