Advertisement
Si_Tukang

Untitled

Mar 22nd, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. ;YouTube Link detector by Ford_Lawnmower irc.Abjects.net #mIRC
  2. alias -l GetLinkDetectorForYoutube {
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Start Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. ;;;; Change %tagcolor to the color you want for tags:
  5. var %tagcolor $+($chr(15),$chr(2))
  6. ;;;; Change %textcolor to the color you want for normal text
  7. var %textcolor $+($chr(15),$chr(3),04)
  8. ;;;; Change %logo to change the YouTube logo
  9. var %logo $+($chr(2),$chr(3),01,$chr(44),00You,$chr(3),00,$chr(44),04Tube,$chr(2))
  10. ;;;; Change %tagSelection to choose the tags you want displayed.
  11. ;;;; Valid tags are: title views likes dislikes uploader and date
  12. var %tagSelection title views likes dislikes uploader date
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14. var %sockname $+(LinkDetectorForYoutube,$network,$2,$ticks,$r(1,1000))
  15. hadd -m %sockname tags %tagSelection
  16. hadd %sockname tagcolor %tagcolor
  17. hadd %sockname textcolor %textcolor
  18. hadd %sockname logo %logo
  19. sockopen %sockname www.youtube.com 80
  20. sockmark %sockname $1-2 $+(/watch?v=,$3)
  21. }
  22. menu Channel,Status {
  23. .$iif($group(#LinkDetectorForYoutube) == On,$style(1)) LinkDetectorForYoutube
  24. ..$iif($group(#LinkDetectorForYoutube) == On,$style(2)) On: .enable #LinkDetectorForYoutube
  25. ..$iif($group(#LinkDetectorForYoutube) == Off,$style(2)) Off: .disable #LinkDetectorForYoutube
  26. }
  27. #LinkDetectorForYoutube on
  28. On $*:Text:/(^[\+-])ytdetect$|(http\x3a\/\/|www\.)[\S]*youtube.com[\S]+v\=([\S]{11})/Si:#: {
  29. var %action $strip($regml(1)), %id $strip($regml(2))
  30. if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
  31. if (%action == +) {
  32. if ($istok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the LinkDetectorForYoutube script }
  33. else {
  34. .enable #LinkDetectorForYoutube
  35. set %LinkDetectorForYoutubeChanList $addtok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)
  36. .msg $chan $nick has activated the LinkDetectorForYoutube script for $chan .
  37. }
  38. }
  39. else {
  40. if (!$istok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the LinkDetectorForYoutube script }
  41. else {
  42. Set %LinkDetectorForYoutubeChanList $remtok(%LinkDetectorForYoutubeChanList,$+($network,$chan),1,32)
  43. .msg $chan $nick has deactivated the LinkDetectorForYoutube script for $chan .
  44. }
  45. }
  46. }
  47. elseif (!$timer($+(LinkDetectorForYoutube,$network,$nick))) && ($istok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)) {
  48. .timer $+ $+(LinkDetectorForYoutube,$network,$nick) 1 4 noop
  49. GetLinkDetectorForYoutube .msg $chan %id
  50. }
  51. }
  52. #LinkDetectorForYoutube end
  53. On *:sockopen:LinkDetectorForYoutube*: {
  54. if (!$sockerr) {
  55. sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
  56. sockwrite -n $sockname Host: $sock($sockname).addr
  57. sockwrite -n $sockname $crlf
  58. }
  59. else { sockclose $sockname | return }
  60. }
  61. On *:sockread:LinkDetectorForYoutube*: {
  62. if ($sockerr) { sockclose $sockname | return }
  63. else {
  64. var %LinkDetectorForYoutube | sockread %LinkDetectorForYoutube
  65. if ($regex(%LinkDetectorForYoutube,/<span class="likes">(.*?)<\/span>.*<span class="dislikes">(.*?)<\/span>/)) {
  66. hadd $sockname likes $+($hget($sockname,tagcolor),Likes:) $+($hget($sockname,textcolor),$regml(1))
  67. hadd $sockname dislikes $+($hget($sockname,tagcolor),Disikes:) $+($hget($sockname,textcolor),$regml(2))
  68. if ($hget($sockname,tags)) $gettok($sock($sockname).mark,1-2,32) $hget($sockname,logo) $Xchr($regsubex($v1,/([\S]+)/g,$hget($sockname,\t)))
  69. if ($hget($sockname)) hfree $sockname
  70. sockclose $sockname
  71. }
  72. elseif ($regex(%LinkDetectorForYoutube,/<span class="likes">(.*?)<\/span>/)) {
  73. hadd $sockname likes $+($hget($sockname,tagcolor),Likes:) $+($hget($sockname,textcolor),$regml(1))
  74. }
  75. elseif ($regex(%LinkDetectorForYoutube,/<span class="dislikes">(.*?)<\/span>/)) {
  76. hadd $sockname dislikes $+($hget($sockname,tagcolor),Disikes:) $+($hget($sockname,textcolor),$regml(1))
  77. if ($hget($sockname,tags)) $gettok($sock($sockname).mark,1-2,32) $hget($sockname,logo) $Xchr($regsubex($v1,/([\S]+)/g,$hget($sockname,\t)))
  78. if ($hget($sockname)) hfree $sockname
  79. sockclose $sockname
  80. }
  81. elseif (<span class="watch-view-count"> isin %LinkDetectorForYoutube) hadd $sockname viewsFound 1
  82. elseif ($hget($sockname,viewsFound)) && ($regex(%LinkDetectorForYoutube,/<strong>(.*?)<\/strong>/)) {
  83. hadd $sockname viewsFound 0
  84. hadd $sockname views $+($hget($sockname,tagcolor),Views:) $+($hget($sockname,textcolor),$regml(1))
  85. }
  86. elseif (*Uploaded by* iswm %LinkDetectorForYoutube) {
  87. hadd $sockname UploaderFound 1
  88. }
  89. elseif ($hget($sockname,UploaderFound)) {
  90. hadd $sockname uploader $+($hget($sockname,tagcolor),Uploader:) $+($hget($sockname,textcolor),%LinkDetectorForYoutube)
  91. hadd $sockname UploaderFound 0
  92. }
  93. elseif ($regex(%LinkDetectorForYoutube,/class="watch-video-date"\s>(.*?)<\/span>/)) {
  94. hadd $sockname date $+($hget($sockname,tagcolor),Upload Date:) $+($hget($sockname,textcolor),$regml(1))
  95. }
  96. elseif ($regex(%LinkDetectorForYoutube,/class="long-title".*title="(.*?)">/)) {
  97. hadd $sockname title $+($hget($sockname,tagcolor),Title:) $+($hget($sockname,textcolor),$regml(1))
  98. }
  99. elseif ($regex(%LinkDetectorForYoutube,/<meta\sname="title"\scontent="(.*?)">/)) {
  100. hadd $sockname title $+($hget($sockname,tagcolor),Title:) $+($hget($sockname,textcolor),$regml(1))
  101. }
  102. }
  103. }
  104. on *:sockclose:LinkDetectorForYoutube*: if ($hget($sockname)) hfree $sockname
  105. alias -l Xchr {
  106. var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
  107. return $replacecs(%return,&ndash;,–,&middot;,·,&raquo;,»,&laquo;,«,&Uuml;,Ü,&uuml;,ü,&Aacute;,Á,&aacute;,á,&Eacute;,$&
  108. É,&eacute;,é,&Iacute;,Í,&iacute;,í,&Oacute;,Ó,&oacute;,ó,&Ntilde;,Ñ,&ntilde;,ñ,&Uacute;,Ú,&uacute;,ú,&nbsp;,$chr(32),$&
  109. &aelig;,æ,&quot;,")
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement