Guest User

Untitled

a guest
Aug 6th, 2020
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;YouTube Script (Parse Vids and Search) v6.0
  2. ;Made by nick1
  3. ;Last edit May 11, 2015
  4. ;For help/setup type /YouTube in mIRC
  5. ;2D0 -- Open to suggestions!
  6. ;EDITS -- v3 API major fix because had wrong port for SSL, duration fixes, description fixes
  7.  
  8. alias -l yversion { return v6.0 }
  9. alias -l yapi { return AIzaSyBZFSgBuREDKNRwHqvHix68W3WiMyZ3N6c }
  10.  
  11. menu status {
  12. YouTube:youtube
  13. }
  14.  
  15. alias YouTube { dialog -m YouTube YouTube }
  16.  
  17. dialog Youtube {
  18. title "YouTube v6.0"
  19. size -1 -1 242 196
  20. option dbu
  21. icon $mircdirYoutube.ico, 0
  22. link "View Script On Hawkee", 1, 3 2 59 8
  23. button "Exit", 7, 88 181 72 12, cancel
  24. tab "About", 10, 2 9 235 169
  25. link "YouTube Script (Parse Vids and Search) v6.0 -- Post Bugs and Feature Requests Here", 24, 16 26 208 8, tab 10
  26. text "Last updated on May 11 2015", 19, 7 66 95 8, tab 10
  27. text "Please post suggestions, complaints, or bugs on the hawkee link (or in chat)", 20, 7 37 188 8, tab 10
  28. text "!commands will notice the user; @commands will be public to the channel", 13, 7 93 175 8, tab 10
  29. text "Default behavior is to run on every channel for every nick. Use the Nick and Channel Settings Tabs to change it for invidividual channels or nicks.", 65, 7 114 208 14, tab 10
  30. link "Click here to chat (leave a message for nick1)", 66, 58 50 110 8, tab 10
  31. text "Use the Basic Options Tab to adjust which parts of the script will run and basic formatting options.", 23, 7 142 195 13, tab 10
  32. button "Check for Updates", 21, 91 64 54 12, tab 10
  33. tab "Basic Options", 2
  34. box "Search Commands/Options", 60, 7 52 209 29, tab 2
  35. text "youtube <search terms>; ytsearch <search>; ysearch <search terms>", 62, 10 60 175 8, tab 2
  36. box "Disable Options", 5, 7 23 209 27, tab 2
  37. check "Disable Search - Disables search commands below", 11, 11 29 133 10, tab 2 flat
  38. check "Disable Parse - Disables the script from automatically sending info", 14, 11 38 175 10, tab 2 flat
  39. box "Output Options", 9, 7 83 209 82, tab 2
  40. check "Disable Views - Removes 'Views: <Views>'", 15, 11 90 123 10, tab 2
  41. check "Disable Length - Removes 'Length: <Length>'", 16, 11 99 130 10, tab 2
  42. check "Disable User - Removes 'User: <User>'", 17, 11 108 113 10, tab 2
  43. check "Disable Formatting - Removes Colors and Bold", 22, 11 117 127 10, tab 2
  44. edit "", 58, 99 69 15 10, tab 2 limit 1
  45. text "Number of search results displayed:", 25, 10 70 87 8, tab 2
  46. check "Enable Date - Adds 'Uploaded: <Date>'", 57, 11 126 120 10, tab 2
  47. check "Enable Likes - Adds 'Likes: <Likes>", 27, 11 135 130 10, tab 2
  48. check "Enable Dislikes - Adds 'Dislikes: <Dislikes>", 28, 11 144 130 10, tab 2
  49. check "Enable Description - Adds 'Description <Description>", 29, 11 153 139 10, tab 2
  50. tab "Channel Settings", 3
  51. list 6, 8 56 220 116, tab 3 sort size extsel vsbar
  52. edit "", 8, 9 26 155 25, tab 3 multi autohs autovs
  53. text "List of channels the script will NOT run on", 12, 48 50 101 6, tab 3
  54. button "Add", 4, 190 25 37 12, tab 3
  55. button "Remove", 63, 190 42 37 12, tab 3
  56. button "Click here to enter #channels ...", 64, 10 27 153 23, tab 3
  57. tab "Nick Settings", 26
  58. text "List of nicks the script will NOT run for", 70, 48 50 101 6, tab 26
  59. list 71, 8 56 220 116, tab 26 sort size extsel vsbar
  60. button "Remove", 72, 190 42 37 12, tab 26
  61. button "Add", 73, 190 25 37 12, tab 26
  62. edit "", 69, 9 26 155 25, tab 26 multi autohs autovs
  63. button "Click here to enter Nicks ...", 74, 10 27 153 23, tab 26
  64. text "This script created by nick1", 18, 171 2 66 8
  65. }
  66.  
  67. on *:dialog:youtube:init:0: {
  68. FillChannelBox
  69. FillNickBox
  70. $iif(%_youtube.nocolor == true,did -c youtube 22,noop)
  71. did -a youtube 58 $iif(%_youtube.limit == $null,1,%_youtube.limit)
  72. $iif(%_youtube.noviews == true,did -c youtube 15,noop)
  73. $iif(%_youtube.nolength == true,did -c youtube 16,noop)
  74. $iif(%_youtube.nouser == true,did -c youtube 17,noop)
  75. $iif(%_youtube.date == true,did -c youtube 57,noop)
  76. $iif(%_youtube.likes == true,did -c youtube 27,noop)
  77. $iif(%_youtube.dislikes == true,did -c youtube 28,noop)
  78. $iif(%_youtube.description == true,did -c youtube 29,noop)
  79. $iif($group(#search) != on,did -c youtube 11,noop)
  80. $iif($group(#parse) != on,did -c youtube 14,noop)
  81. }
  82. alias FillChannelBox {
  83. did -r youtube 6
  84. var %y 1
  85. while (%y <= $numtok(%youtubefetch,44)) {
  86. did -a youtube 6 $gettok(%youtubefetch,%y,44)
  87. inc %y
  88. }
  89. }
  90. alias FillNickBox {
  91. did -r youtube 71
  92. var %y 1
  93. while (%y <= $numtok(%nolinks,44)) {
  94. did -a youtube 71 $gettok(%nolinks,%y,44)
  95. inc %y
  96. }
  97. }
  98. on *:dialog:youtube:edit:58: {
  99. if (($did(58).text < 1) || ($did(58).text !isnum) && ($did(58).text != $null)) {
  100. did -r youtube 58
  101. noop $input(Enter a number between 1 and 9, owd, Invalid input!)
  102. }
  103. elseif ($did(58).text != $null) { set %_youtube.limit $did(58).text }
  104. }
  105. on *:dialog:youtube:sclick:*: {
  106. if (($did == 1) || ($did == 24)) { run http://hawkee.com/snippet/8577/ }
  107. elseif ($did == 66) { server -m irc.rizon.net:6667 -jn #rsbot_help }
  108. elseif ($did == 22) { set %_youtube.nocolor $iif($did(22).state,true,false) }
  109. elseif ($did == 15) { set %_youtube.noviews $iif($did(15).state,true,false) }
  110. elseif ($did == 16) { set %_youtube.nolength $iif($did(16).state,true,false) }
  111. elseif ($did == 17) { set %_youtube.nouser $iif($did(17).state,true,false) }
  112. elseif ($did == 57) { set %_youtube.date $iif($did(57).state,true,false) }
  113. elseif ($did == 27) { set %_youtube.likes $iif($did(27).state,true,false) }
  114. elseif ($did == 28) { set %_youtube.dislikes $iif($did(28).state,true,false) }
  115. elseif ($did == 29) { set %_youtube.description $iif($did(29).state,true,false) }
  116. elseif ($did == 11) { $iif($group(#search) == on,.disable,.enable) #search }
  117. elseif ($did == 21) { yupdate }
  118. elseif ($did == 14) { $iif($group(#parse) == on,.disable,.enable) #parse }
  119. elseif ($did == 4) {
  120. set %youtubefetch $addtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
  121. did -r youtube 8
  122. FillChannelBox
  123. }
  124. elseif ($did == 73) {
  125. set %nolinks $addtok(%nolinks,$did(69),44)
  126. did -r youtube 69
  127. FillNickBox
  128. }
  129. elseif ($did == 63) {
  130. if ($did(8) != $null) {
  131. set %youtubefetch $remtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
  132. did -r youtube 8
  133. }
  134. if ($did(6).seltext != $null) { set %youtubefetch $remtok(%youtubefetch,$did(6).seltext,44) }
  135. FillChannelBox
  136. }
  137. elseif ($did == 3) { did -t youtube 4 }
  138. elseif ($did == 26) { did -t youtube 73 }
  139. elseif ($did == 72) {
  140. if ($did(69) != $null) {
  141. set %nolinks $remtok(%nolinks,$did(69),44)
  142. did -r youtube 69
  143. }
  144. if ($did(71).seltext != $null) { set %nolinks $remtok(%nolinks,$did(71).seltext,44) }
  145. FillNickBox
  146. }
  147. }
  148.  
  149. raw 408:*: msg $2 $remove($strip($13-),$chr(9),$chr(8))
  150.  
  151. alias urlencode { return $replacex($regsubex($$1-,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))),$chr(32),+,$chr(43),%2B) }
  152.  
  153. on $*:text:/^[!@](disableyt|offyt|disableyoutube|offyoutube)(\s|$)/Si:?: {
  154. if ($2) {
  155. if ($me ison $2) {
  156. if ($nick isop $2) {
  157. msg $nick 4Youtube has been10 disabled on $+(,$2,)
  158. set %youtubefetch $addtok(%youtubefetch,$2,44)
  159. }
  160. else { msg $nick 4Sorry, you must be an10 op of $+(,$2,) to disable youtube there }
  161. }
  162. else { msg $nick 4Sorry, I am not10 currently in $+(,$2,) }
  163. }
  164. elseif ($2 == $null) { msg $nick 4Incorrect Syntax - Use10 $1 <#channel> }
  165. }
  166. on $*:text:/^[!@](enableyt|onyt|enableyoutube|onyoutube)(\s|$)/Si:?: {
  167. if ($2) {
  168. if ($me ison $2) {
  169. if ($nick isop $2) {
  170. msg $nick 4Youtube has been10 enabled on $+(,$2,)
  171. set %youtubefetch $remtok(%youtubefetch,$2,44)
  172. }
  173. else { msg $nick 4Sorry, you must be an10 op of $+(,$2,) to enable youtube there }
  174. }
  175. else { msg $nick 4Sorry, I am not10 currently in $+(,$2,) }
  176. }
  177. elseif ($2 == $null) { msg $nick 4Incorrect Syntax - Use10 $1 <#channel> }
  178. }
  179.  
  180. #search off
  181. on $*:text:/^[!@]y(outube|t|tsearch|search|ousearch|outubesearch)(\s|$)/Si:%YouTube: {
  182. $iif($istok(%youtubefetch,$chan,44),halt,noop)
  183. $iif($istok(%nolinks,$nick,44),halt,noop)
  184. if ($($+(%,botflood.,$nick),2)) {
  185. if ($($+(%,botflood.,$nick),2) >= 50) {
  186. ignore -u60 $address($nick,2)
  187. msg $chan $+($nick,$chr(44)) Ignorado 60secs por abusar del bot.
  188. halt
  189. }
  190. elseif ($($+(%,botflood.,$nick),2) >= 40) {
  191. msg $chan $+($nick,$chr(44)) Por favor no haga flood al bot.
  192. inc -z $+(%,botflood.,$nick) 20
  193. halt
  194. }
  195. else { inc -z $+(%,botflood.,$nick) 25 }
  196. }
  197. else { inc -z $+(%,botflood.,$nick) 25 }
  198. var %ticks $ticks
  199. if ($2) {
  200. set $+(%,youtube.,%ticks,.msgtype) $iif($chan,$iif($left($strip($1),1) == @,msg $chan,notice $nick),msg $nick)
  201. set $+(%,youtube.,%ticks,.search) $2-
  202. set $+(%,youtube.,%ticks,.query) $urlencode($2-)
  203. sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  204. }
  205. elseif ($2 == $null) {
  206. notice $nick 4Incorrect Syntax - Use10 $1 <search term>
  207. }
  208. }
  209.  
  210. on *:input:*:{
  211. $iif($istok(%nolinks,$active,44),return,noop)
  212. $iif($istok(%youtubefetch,$active,44),return,noop)
  213. var %ticks $ticks
  214. if (($remove($1,$left($strip($1),1)) == ysearch) || ($remove($1,$left($strip($1),1)) == ytsearch) || ($remove($1,$left($strip($1),1)) == youtube) || ($remove($1,$left($strip($1),1)) == yt) || ($remove($1,$left($strip($1),1)) == youtubesearch)) {
  215. if ($left($1,1) != /) {
  216. if ($2 != $null) {
  217. set $+(%,youtube.,%ticks,.msgtype) msg $active
  218. set $+(%,youtube.,%ticks,.search) $2-
  219. set $+(%,youtube.,%ticks,.query) $urlencode($2-)
  220. sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  221. }
  222. elseif ($2 == $null) {
  223. .timerYTInputSyntax -m 1 100 echo -at 4Incorrect Syntax - Use10 $1 <search term>
  224. }
  225. }
  226. }
  227. elseif ((*youtube.com* iswm $1-) || (*youtu.be* iswm $1-)) {
  228. if ($left($1,1) != /) {
  229. var %i 1
  230. while (%i <= $numtok($1-,32)) {
  231. if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
  232. set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
  233. var %tag $($+(%,youtube.,%ticks,.url),2)
  234. var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
  235. var %tag $deltok($deltok(%tag,2,35),2,38)
  236. if (*youtu.be* iswm %tag) { var %tag $gettok(%tag,1,63) }
  237. set $+(%,youtube.,%ticks,.tag) $remove(%tag,?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
  238. }
  239. inc %i
  240. }
  241. if ($($+(%,youtube.,%ticks,.tag),2) == $null) {
  242. unset $+(%,youtube.,%ticks,.*)
  243. }
  244. else {
  245. set $+(%,youtube.,%ticks,.msgtype) msg $active
  246. set $+(%,youtube.,%ticks,.nick) $nick
  247. set $+(%,youtube.,%ticks,.chan) $chan
  248. set $+(%,youtube.,%ticks,.network) $network
  249. sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  250. }
  251. }
  252. }
  253. }
  254.  
  255. #search end
  256.  
  257. #parse on
  258. on $*:text:/youtu(.be|be.com)/Si:%YouTube: {
  259. $iif($istok(%youtubefetch,$chan,44),halt,noop)
  260. $iif($istok(%nolinks,$nick,44),halt,noop)
  261. if ($($+(%,botflood.,$nick),2)) {
  262. if ($($+(%,botflood.,$nick),2) >= 50) {
  263. ignore -u60 $address($nick,2)
  264. msg $chan $+($nick,$chr(44)) Ignorado 60secs por abusar del bot.
  265. halt
  266. }
  267. elseif ($($+(%,botflood.,$nick),2) >= 40) {
  268. msg $chan $+($nick,$chr(44)) Por favor no haga flood al bot.
  269. inc -z $+(%,botflood.,$nick) 20
  270. halt
  271. }
  272. else {
  273. inc -z $+(%,botflood.,$nick) 10
  274. }
  275. }
  276. else { inc -z $+(%,botflood.,$nick) 10 }
  277. var %i 1
  278. var %ticks $ticks
  279. while (%i <= $numtok($1-,32)) {
  280. if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
  281. set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
  282. var %tag $($+(%,youtube.,%ticks,.url),2)
  283. var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
  284. var %tag $deltok($deltok(%tag,2,35),2,38)
  285. if (*youtu.be* iswm %tag) { var %tag $gettok(%tag,1,63) }
  286. set $+(%,youtube.,%ticks,.tag) $remove(%tag,?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
  287. }
  288. inc %i
  289. }
  290. set $+(%,youtube.,%ticks,.msgtype) msg $iif($chan,$v1,$nick)
  291. if (($($+(%,youtube.,%ticks,.tag),2) != %_youtube.last) && ($($+(%,youtube.,%ticks,.tag),2) != $null)) {
  292. set $+(%,youtube.,%ticks,.nick) $nick
  293. set $+(%,youtube.,%ticks,.chan) $chan
  294. set $+(%,youtube.,%ticks,.network) $network
  295. sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  296. }
  297. }
  298. on $*:action:/youtu(.be|be.com)/Si:%YouTube: {
  299. $iif($istok(%youtubefetch,$chan,44),halt,noop)
  300. $iif($istok(%nolinks,$nick,44),halt,noop)
  301. if ($($+(%,botflood.,$nick),2)) {
  302. if ($($+(%,botflood.,$nick),2) >= 50) {
  303. ignore -u60 $address($nick,2)
  304. msg $chan $+($nick,$chr(44)) Ignorado 60secs por abusar del bot.
  305. halt
  306. }
  307. elseif ($($+(%,botflood.,$nick),2) >= 40) {
  308. msg $chan $+($nick,$chr(44)) Por favor no haga flood al bot.
  309. inc -z $+(%,botflood.,$nick) 20
  310. halt
  311. }
  312. else {
  313. inc -z $+(%,botflood.,$nick) 10
  314. }
  315. }
  316. else { inc -z $+(%,botflood.,$nick) 10 }
  317. var %i 1
  318. var %ticks $ticks
  319. while (%i <= $numtok($1-,32)) {
  320. if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
  321. set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
  322. var %tag $($+(%,youtube.,%ticks,.url),2)
  323. var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
  324. var %tag $deltok($deltok(%tag,2,35),2,38)
  325. if (*youtu.be* iswm %tag) { var %tag $gettok(%tag,1,63) }
  326. set $+(%,youtube.,%ticks,.tag) $remove(%tag,?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
  327. }
  328. inc %i
  329. }
  330. set $+(%,youtube.,%ticks,.msgtype) msg $iif($chan,$v1,$nick)
  331. if (($($+(%,youtube.,%ticks,.tag),2) != %_youtube.last) && ($($+(%,youtube.,%ticks,.tag),2) != $null)) {
  332. set $+(%,youtube.,%ticks,.nick) $nick
  333. set $+(%,youtube.,%ticks,.chan) $chan
  334. set $+(%,youtube.,%ticks,.network) $network
  335. sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  336. }
  337. }
  338.  
  339. #parse end
  340.  
  341. on *:sockopen:youtube*: {
  342. var %ticks $remove($sockname,youtube.)
  343. var %x sockwrite -nt $sockname
  344. if (($($+(%,youtube.,%ticks,.search),2) != $null) && ($($+(%,youtube.,%ticks,.round2),2) != true)) {
  345. var %temp_search0 /youtube/v3/search?safeSearch=none&order=relevance&part=snippet&q=
  346. %x GET $+(%temp_search0,$($+(%,youtube.,%ticks,.query),2),&maxResults=,$iif(%_youtube.limit == $null,1,%_youtube.limit),&key=,$yapi) HTTP/1.1
  347. }
  348. else {
  349. var %temp_search1 $(/youtube/v3/videos?part=contentDetails%2Cstatistics%2Csnippet&id=,0)
  350. var %temp_search2 &maxResults=1&fields=items $+ $chr(40) $+ $(contentDetails%2Csnippet%2Cstatistics,0) $+ $chr(41)
  351. %x GET $+(%temp_search1,$($+(%,youtube.,%ticks,.tag),2),%temp_search2,&key=,$yapi) HTTP/1.1
  352. }
  353. %x Host: www.googleapis.com
  354. %x $crlf
  355. }
  356. alias nohtml { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
  357. alias yinfo {
  358. var %step1 errRemoval $gettok($1-,2-,58) errRemoval
  359. return $replace($gettok(%step1,$+(2-,$calc($numtok(%step1,34) - 1)),34),\r\n,$chr(32),\n,$chr(32),\","))
  360. }
  361. on *:SOCKREAD:youtube*: {
  362. if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  363. else {
  364. var %ticks $remove($sockname,youtube.)
  365. var %sockreader
  366. sockread %sockreader
  367. if ((*"title": * iswm %sockreader) && ($($+(%,youtube.,%ticks,.title),2) == $null)) {
  368. set $+(%,youtube.,%ticks,.title) $yinfo(%sockreader)
  369. if ($($+(%,youtube.,%ticks,.search),2) != $null) {
  370. var %i 0
  371. while (%i <= $numtok($($+(%,youtube.,%ticks,.search),2),32)) {
  372. inc %i
  373. set $+(%,youtube.,%ticks,.title) $regsubex($($+(%,youtube.,%ticks,.title),2), /\b( $gettok($($+(%,youtube.,%ticks,.search),2),%i,32) )\b/gix, $+($chr(2), \1, $chr(2)))
  374. }
  375. }
  376. ;Badword replacement below--useful for bots that kick on badword list. Replace or add words to censor <word,replacement>
  377. set $+(%,youtube.,%ticks,.title) $replace($($+(%,youtube.,%ticks,.title),2),faggot,f****t,nigger,n****r)
  378. }
  379. elseif (*"videoId": * iswm %sockreader) {
  380. set $+(%,youtube.,%ticks,.tag) $yinfo(%sockreader)
  381. sockclose $sockname
  382. set $+(%,youtube.,%ticks,.round2) true
  383. sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  384. }
  385. elseif (*channelTitle": * iswm %sockreader) { set $+(%,youtube.,%ticks,.user) $yinfo(%sockreader) }
  386. elseif (*"duration": * iswm %sockreader) {
  387. set $+(%,youtube.,%ticks,.time) $regsubex($duration($calc($replace( $remove($yinfo(%sockreader), P, T), W, *604800+, D, *86400+, H, *3600+, M, *60+, S,*1)), 3), /^[0:]+, )
  388. }
  389. elseif (*"publishedAt": * iswm %sockreader) { set $+(%,youtube.,%ticks,.date) $gettok($yinfo(%sockreader),1,84) }
  390. elseif ((*"description": * iswm %sockreader) && ($($+(%,youtube.,%ticks,.description),2) == $null)) {
  391. var %wrong errRemoval ", errRemoval
  392. var %desc $yinfo(%sockreader)
  393. if (($gettok(%sockreader,4,34) == $null) || (%desc == %wrong)) { set $+(%,youtube.,%ticks,.description) N/A }
  394. else { set $+(%,youtube.,%ticks,.description) $iif($numtok(%desc,32) > 10,$+($gettok(%desc,1-8,32),...),%desc) }
  395. }
  396. elseif (*"viewCount": * iswm %sockreader) { set $+(%,youtube.,%ticks,.viewcount) $bytes($yinfo(%sockreader),bd) }
  397. elseif (*"likeCount": * iswm %sockreader) { set $+(%,youtube.,%ticks,.likes) $bytes($yinfo(%sockreader),bd) }
  398. elseif (*"dislikeCount": * iswm %sockreader) {
  399. set $+(%,youtube.,%ticks,.dislikes) $bytes($yinfo(%sockreader),bd)
  400. set %_youtube.last $($+(%,youtube.,%ticks,.tag),2)
  401. $iif($($+(%,youtube.,%ticks,.viewcount),2) == 301,set $+(%,youtube.,%ticks,.viewcount) 301+,noop)
  402. var %msg 1,0You0,4Tube $&
  403. $iif($($+(%,youtube.,%ticks,.search),2) == $null,$null, Link : http://youtu.be/ $+ $($+(%,youtube.,%ticks,.tag),2)) $&
  404. - Titulo: $($+(%,youtube.,%ticks,.title),2) $&
  405. $iif(%_youtube.noviews == true,$null,10Views:4 $($+(%,youtube.,%ticks,.viewcount),2)) $&
  406. $iif(%_youtube.nolength == true,$null,- Duración: $($+(%,youtube.,%ticks,.time),2)) $&
  407. $iif(%_youtube.rating == true,$iif($($+(%,youtube.,%ticks,.rating),2) == $null,$null,10Rating:4 $($+(%,youtube.,%ticks,.rating),2)),$null) $&
  408. $iif(%_youtube.date == true,10Uploaded:4 $($+(%,youtube.,%ticks,.date),2),$null) $&
  409. $iif(%_youtube.nouser == true,$null,10User:4 $($+(%,youtube.,%ticks,.user),2))
  410. $($+(%,youtube.,%ticks,.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
  411. inc $+(%,youtube.,%ticks,.number)
  412. if ((%_youtube.limit == $($+(%,youtube.,%ticks,.number),2)) || ($($+(%,youtube.,%ticks,.search),2) == $null)) {
  413. unset $+(%,youtube.,$remove($sockname,youtube.),*)
  414. sockclose $sockname
  415. }
  416. }
  417. elseif (*"totalResults": 0,* iswm %sockreader) {
  418. if ($($+(%,youtube.,%ticks,.number),2) == $null) {
  419. var %msg 1,0You0,4Tube No se encontraron resultados relevantes. Pruebe diferentes términos de búsqueda.
  420. $($+(%,youtube.,%ticks,.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
  421. }
  422. unset $+(%,youtube.,$remove($sockname,youtube.),*)
  423. sockclose $sockname
  424. }
  425. elseif (*"items": []* iswm %sockreader) {
  426. if ($($+(%,youtube.,%ticks,.number),2) == $null) {
  427. var %msg 1,0You0,4Tube Este video se eliminó o ya no está disponible.
  428. $($+(%,youtube.,%ticks,.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
  429. }
  430. unset $+(%,youtube.,$remove($sockname,youtube.),*)
  431. sockclose $sockname
  432. }
  433. }
  434. }
  435.  
  436. off *:start: .timerYTUpdate 1 60 yupdate
  437. alias yupdate {
  438. echo -atc info 12[04YouTube12] Checking for updates...
  439. sockopen yupdate hawkee.com 80
  440. }
  441. on *:sockopen:yupdate: {
  442. var %x sockwrite -nt $sockname
  443. %x GET /snippet/8577/ HTTP/1.1
  444. %x Host: hawkee.com
  445. %x $crlf
  446. }
  447. on *:SOCKREAD:yupdate: {
  448. if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  449. sockread %sockreader
  450. if (*<title>* iswm %sockreader) {
  451. var %x $remove($gettok($nohtml(%sockreader),7-,32),- mIRC)
  452. echo -atc info 12[04YouTube12] Current: $yversion Latest: %x Status: $iif($yversion == %x,Up to date,Please check for updates at http://hawkee.com/snippet/8577/)
  453. unset %sockreader
  454. sockclose $sockname
  455. }
  456. }
  457.  
RAW Paste Data