Advertisement
mja00

Untitled

Jun 10th, 2016
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;Youtube Link Parser! Credits to Wikked ( irc.g0dz.net +6697 (SSL ONLY) );;;;
  3. ;;;;;By OrFeAsGr: http://humanity.ucoz.com ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;;; http://hawkee.com/snippet/17106/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6. on *:text:*:#: {
  7. tokenize 32 $strip($1-,burci)
  8. if (youtube.com isin $1-) { var %yt_t $gettok($1-,2,61) | set %yt_c # | _youtube %yt_t }
  9. if (youtu.be isin $1-) { var %yt_t $gettok($1-,3,47) | set %yt_c # | _youtube %yt_t }
  10. }
  11. on *:action:*:#: {
  12. tokenize 32 $strip($1-,burci)
  13. if (youtube.com isin $1-) { var %yt_t $gettok($1-,2,61) | set %yt_c # | _youtube %yt_t }
  14. if (youtu.be isin $1-) { var %yt_t $gettok($1-,3,47) | set %yt_c # | _youtube %yt_t }
  15. }
  16.  
  17. alias _YouTube {
  18. sockclose $+(Ytb,.,$1)
  19. sockopen -e $+(Ytb,.,$1) www.googleapis.com 443
  20. }
  21. on *:sockopen:*: {
  22. if (Ytb* iswm $sockname) {
  23. if ($sockerr) { sockclose $sockname | halt }
  24. sockwrite -nt $sockname GET /youtube/v3/videos?id= $+ $remove($sockname,Ytb.) $+ &key=AIzaSyCzHxG53pxE0hWrWBIMMGm75PRHBQ8ZP8c&part=snippet,contentDetails,statistics,topicDetails HTTP/1.1
  25. sockwrite -nt $sockname Host: www.googleapis.com
  26. sockwrite -nt $sockname $crlf
  27. }
  28. }
  29. on *:sockread:*: {
  30. if (Ytb* iswm $sockname) {
  31. if ($sockerr) { return }
  32. var %read
  33. sockread -f %read
  34. while ($sockbr) {
  35. if (%read) {
  36. if ("title" isin $gettok(%read,1,32)) { set %yt_title $left($noqt($gettok(%read,2-,32)),-2) }
  37. if ("categoryId" isin $gettok(%read,1,32)) {
  38. var %a = $left($noqt($gettok(%read,2-,32)),-2)
  39. set %yt_category $replace(%a,1,Film & Animation,02,Autos & Vehicles,10,Music,15,Pets & Animals,17,Sports,18,Short Movies,19,Travel & Events,20,Gaming,21,Videoblogging,22,People & Blogs,23,Comedy,24,Entertainment,25,News & Politics,26,Howto & Style,27,Education,28,Science & Technology,29,Nonprofits & Activism,30,Movies,31,Anime/Animation,32,Action/Adventure,33,Classics,34,Comedy,35,Documentary,36,Drama,37,Family,38,Foreign,39,Horror,40,Sci-Fi/Fantasy,41,Thriller,42,Shorts,43,Shows,44,Trailers)
  40. }
  41. if ("viewCount" isin $gettok(%read,1,32)) { set %yt_views $left($noqt($gettok(%read,2-,32)),-2) }
  42. if ("likeCount" isin $gettok(%read,1,32)) { set %yt_likes $left($noqt($gettok(%read,2-,32)),-2) }
  43. if ("dislikeCount" isin $gettok(%read,1,32)) { set %yt_dislikes $left($noqt($gettok(%read,2-,32)),-2) }
  44. if ("channelTitle" isin $gettok(%read,1,32)) { set %yt_uploaded $left($noqt($gettok(%read,2-,32)),-2) }
  45. if ("duration" isin $gettok(%read,1,32)) { set %yt_duration $get_duration($left($noqt($gettok(%read,2-,32)),-1)) }
  46. if ("commentCount" isin $gettok(%read,1,32)) {
  47. set %yt_comments $noqt($gettok(%read,2-,32))
  48. sockclose $sockname
  49. msg %yt_c Title: %yt_title
  50. msg %yt_c Category: %yt_category
  51. msg %yt_c Views: $comma(%yt_views)
  52. msg %yt_c Likes: $comma(%yt_likes)
  53. msg %yt_c Dislikes: $comma(%yt_dislikes)]
  54. msg %yt_c Uploaded by: %yt_uploaded
  55. msg %yt_c Duration: %yt_duration
  56. unset %yt_*
  57. return
  58. }
  59. }
  60. sockread -f %read
  61. }
  62. }
  63. }
  64. alias get_duration {
  65. if (!$1) { return 0 }
  66. var %d = $1
  67. var %d = $remove(%d,P,T)
  68. var %d = $replacex(%d,W,wk $chr(32),D,days $chr(32),h,hrs $chr(32),M,mins $chr(32),S,secs)
  69. var %d = $duration(%d,3)
  70. var %dd = $duration(%d,3)
  71. return $iif(%dd,$v1,00:00:00)
  72. }
  73.  
  74. alias get_date {
  75. if (!$1-) { return 0 }
  76. var %d = $1-
  77. var %d = $remove($replace(%d,$chr(84),$chr(32)),$chr(90))
  78. if (*.* iswm %d) {
  79. var %tmp_d = $gettok(%d,1,32)
  80. var %tmp_t = $remove($gettok(%d,2,32),.)
  81. var %d = %tmp_d $gettok(%tmp_t,1,58) $+ : $+ $gettok(%tmp_t,2,58) $+ : $+ $mid($gettok(%tmp_t,3,58),4)
  82. }
  83. var %d = $ctime($remove(%d,$chr(44)))
  84. var %d = $date(%d,ddd ddoo mmm yyyy HH:nn:ss)
  85. if (!$prop) { return %d }
  86. if ($prop) && ($prop == date) { return $iif(%d,$v1,0) }
  87. if ($prop) && ($prop == ctime) { return $iif($ctime(%d),$v1,0) }
  88. }
  89.  
  90. alias -l comma {
  91. var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
  92. return %a
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement