Project

General

Profile

YouTube scipt

Added by Q Steinberg over 4 years ago

I was hoping that it would work on AdiIRC, but unfortunately it doesn't.

The only error I noticed was: after loading the script, i type /youtube and the script box opens, I try to add room names where I don't want the script to work at, but I'm unable to enter a room name.

Is it possible for that youtube script to work on AdiIRC??

(Sorry if I'm violating any rules. I'm new!)

[script]
n0=;YouTube Script (Parse Vids and Search) v6.4
n1=;Made by nick1
n2=;Last edit June 20, 2016
n3=;For help/setup type /YouTube in mIRC
n4=;2D0 -- You tell me in the comments! http://hawkee.com/snippet/8577/
n5=;EDITS -- Fixed bug where youtube.com would say invalid video (and cleaned up some other code in the parse section)
n6=
n7=alias l yversion { return v6.4 }
n8=alias -l yapi { return AIzaSyBZFSgBuREDKNRwHqvHix68W3WiMyZ3N6c }
n9=
n10=menu status,channel,query {
n11= YouTube:youtube
n12=}
n13=
n14=alias YouTube { dialog -m YouTube YouTube }
n15=
n16=dialog Youtube {
n17= title "YouTube v6.4"
n18= size -1 -1 242 196
n19= option dbu
n20= icon $mircdirYoutube.ico, 0
n21= link "View Script On Hawkee", 1, 3 2 59 8
n22= button "Exit", 7, 88 181 72 12, cancel
n23= tab "About", 10, 2 9 235 169
n24= link "YouTube Script (Parse Vids and Search) v6.4 -
Post Bugs and Feature Requests Here", 24, 16 26 208 8, tab 10
n25= text "Last updated on June 20 2016", 19, 7 66 95 8, tab 10
n26= text "Please post suggestions, complaints, or bugs on the hawkee link (or in chat)", 20, 7 37 188 8, tab 10
n27= text "!commands will notice the user; commands will be public to the channel", 13, 7 93 175 8, tab 10
n28= 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
n29= link "Click here to chat (leave a message for nick1)", 66, 58 50 110 8, tab 10
n30= 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
n31= button "Check for Updates", 21, 102 64 54 12, tab 10
n32= tab "Basic Options", 2
n33= box "Search Commands/Options", 60, 7 52 209 29, tab 2
n34= text "youtube <search terms>; ytsearch <search>; ysearch <search terms>", 62, 10 60 175 8, tab 2
n35= box "Disable Options", 5, 7 23 209 27, tab 2
n36= check "Disable Search - Disables search commands below", 11, 11 29 133 10, tab 2 flat
n37= check "Disable Parse - Disables the script from automatically sending info", 14, 11 38 175 10, tab 2 flat
n38= box "Output Options", 9, 7 83 209 93, tab 2
n39= check "Disable Views - Removes 'Views: <Views>'", 15, 11 90 123 10, tab 2
n40= check "Disable Length - Removes 'Length: <Length>'", 16, 11 99 130 10, tab 2
n41= check "Disable User - Removes 'User: <User>'", 17, 11 108 113 10, tab 2
n42= check "Disable Formatting - Removes Colors and Bold", 22, 11 117 127 10, tab 2
n43= edit "", 58, 99 69 15 10, tab 2 limit 1
n44= text "Number of search results displayed:", 25, 10 70 87 8, tab 2
n45= check "Enable Date - Adds 'Uploaded: <Date>'", 57, 11 126 120 10, tab 2
n46= check "Enable Likes - Adds 'Likes: <Likes>", 27, 11 135 130 10, tab 2
n47= check "Enable Dislikes - Adds 'Dislikes: <Dislikes>", 28, 11 144 130 10, tab 2
n48= check "Enable Description - Adds 'Description <Description>", 29, 11 153 139 10, tab 2
n49= check "Enable Notice Mode (Does Not Message Channel)", 30, 11 163 139 10, tab 2
n50= tab "Channel Settings", 3
n51= list 6, 8 56 220 116, tab 3 sort size extsel vsbar
n52= edit "", 8, 9 26 155 25, tab 3 multi autohs autovs
n53= text "List of channels the script will NOT run on", 12, 48 50 101 6, tab 3
n54= button "Add", 4, 190 25 37 12, tab 3
n55= button "Remove", 63, 190 42 37 12, tab 3
n56= button "Click here to enter #channels ...", 64, 10 27 153 23, tab 3
n57= tab "Nick Settings", 26
n58= text "List of nicks the script will NOT run for", 70, 48 50 101 6, tab 26
n59= list 71, 8 56 220 116, tab 26 sort size extsel vsbar
n60= button "Remove", 72, 190 42 37 12, tab 26
n61= button "Add", 73, 190 25 37 12, tab 26
n62= edit "", 69, 9 26 155 25, tab 26 multi autohs autovs
n63= button "Click here to enter Nicks ...", 74, 10 27 153 23, tab 26
n64= text "This script created by nick1", 18, 171 2 66 8
n65=}
n66=
n67=on *:dialog:youtube:init:0: {
n68= FillChannelBox
n69= FillNickBox
n70= $iif(%_youtube.nocolor true,did -c youtube 22,noop)
n71= did -a youtube 58 $iif(%_youtube.limit $null,1,%_youtube.limit)
n72= $iif(_youtube.noviews true,did -c youtube 15,noop)
n73= $iif(%_youtube.nolength true,did c youtube 16,noop)
n74= $iif(
_youtube.nouser true,did -c youtube 17,noop)
n75= $iif(%_youtube.date true,did -c youtube 57,noop)
n76= $iif(_youtube.likes true,did -c youtube 27,noop)
n77= $iif(%_youtube.dislikes true,did -c youtube 28,noop)
n78= $iif(
_youtube.description true,did -c youtube 29,noop)
n79= $iif(%_youtube.notices true,did -c youtube 30,noop)
n80= $iif($group(#search) != on,did -c youtube 11,noop)
n81= $iif($group(#parse) != on,did -c youtube 14,noop)
n82=}
n83=alias FillChannelBox {
n84= did -r youtube 6
n85= var y 1
n86= while (%y <= $numtok(%youtubefetch,44)) {
n87= did -a youtube 6 $gettok(%youtubefetch,%y,44)
n88= inc %y
n89= }
n90=}
n91=alias FillNickBox {
n92= did -r youtube 71
n93= var %y 1
n94= while (%y <= $numtok(%nolinks,44)) {
n95= did -a youtube 71 $gettok(%nolinks,%y,44)
n96= inc %y
n97= }
n98=}
n99=on :dialog:youtube:edit:58: {
n100= if (($did(58).text < 1) || ($did(58).text !isnum) &x%x
($did(58).text != $null)) {
n101= did -r youtube 58
n102= noop $input(Enter a number between 1 and 9, owd, Invalid input!)
n103= }
n104= elseif ($did(58).text != $null) { set _youtube.limit $did(58).text }
n105=}
n106=on *:dialog:youtube:sclick:
: {
n107= if (($did 1) || ($did 24)) { run http://hawkee.com/snippet/8577/ }
n108= elseif ($did 66) { server -m irc.rizon.net:6667 -jn #rsbot_help }
n109= elseif ($did 22) { set %_youtube.nocolor $iif($did(22).state,true,false) }
n110= elseif ($did 15) { set %_youtube.noviews $iif($did(15).state,true,false) }
n111= elseif ($did 16) { set %_youtube.nolength $iif($did(16).state,true,false) }
n112= elseif ($did 17) { set %_youtube.nouser $iif($did(17).state,true,false) }
n113= elseif ($did 57) { set %_youtube.date $iif($did(57).state,true,false) }
n114= elseif ($did 27) { set %_youtube.likes $iif($did(27).state,true,false) }
n115= elseif ($did 28) { set %_youtube.dislikes $iif($did(28).state,true,false) }
n116= elseif ($did 29) { set %_youtube.description $iif($did(29).state,true,false) }
n117= elseif ($did 30) { set %_youtube.notices $iif($did(30).state,true,false) }
n118= elseif ($did 11) { $iif($group(#search) on,.disable,.enable) #search }
n119= elseif ($did 21) { yupdate }
n120= elseif ($did 14) { $iif($group(#parse) on,.disable,.enable) #parse }
n121= elseif ($did 4) {
n122= set %youtubefetch $addtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
n123= did -r youtube 8
n124= FillChannelBox
n125= }
n126= elseif ($did == 73) {
n127= set %nolinks $addtok(%nolinks,$did(69),44)
n128= did -r youtube 69
n129= FillNickBox
n130= }
n131= elseif ($did == 63) {
n132= if ($did(8) != $null) {
n133= set %youtubefetch $remtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
n134= did -r youtube 8
n135= }
n136= if ($did(6).seltext != $null) { set %youtubefetch $remtok(%youtubefetch,$did(6).seltext,44) }
n137= FillChannelBox
n138= }
n139= elseif ($did 3) { did -t youtube 4 }
n140= elseif ($did 26) { did -t youtube 73 }
n141= elseif ($did == 72) {
n142= if ($did(69) != $null) {
n143= set %nolinks $remtok(%nolinks,$did(69),44)
n144= did -r youtube 69
n145= }
n146= if ($did(71).seltext != $null) { set %nolinks $remtok(%nolinks,$did(71).seltext,44) }
n147= FillNickBox
n148= }
n149=}
n150=
n151=raw 408:*: msg $2 $remove($strip($13),$chr(9),$chr(8))
n152=
n153=alias urlencode { return $replacex($regsubex($$1-,/([^\w\s])/Sg,$+(,$base($asc(\t),10,16,2))),$chr(32),+,$chr(43),%2B) }
n154=
n155=on $*:text:/^[!
](disableyt|offyt|disableyoutube|offyoutube)(\s|$)/Si:?: {
n156= if ($2) {
n157= if ($me ison $2) {
n158= if ($nick isop $2) {
n159= msg $nick 4Youtube has been10 disabled on $+(,$2,)
n160= set youtubefetch $addtok(%youtubefetch,$2,44)
n161= }
n162= else { msg $nick 4Sorry, you must be an10 op of $+(,$2,) to disable youtube there }
n163= }
n164= else { msg $nick 4Sorry, I am not10 currently in $+(,$2,) }
n165= }
n166= elseif ($2 == $null) { msg $nick 4Incorrect Syntax - Use10 $1 <#channel> }
n167=}
n168=on $*:text:/^[!](enableyt|onyt|enableyoutube|onyoutube)(\s|$)/Si:?: {
n169= if ($2) {
n170= if ($me ison $2) {
n171= if ($nick isop $2) {
n172= msg $nick 4Youtube has been10 enabled on $+(,$2,)
n173= set %youtubefetch $remtok(%youtubefetch,$2,44)
n174= }
n175= else { msg $nick 4Sorry, you must be an10 op of $+(,$2,) to enable youtube there }
n176= }
n177= else { msg $nick 4Sorry, I am not10 currently in $+(,$2,) }
n178= }
n179= elseif ($2 == $null) { msg $nick 4Incorrect Syntax - Use10 $1 <#channel> }
n180=}
n181=
n182=#search on
n183=on $*:text:/^[!
]y(outube|t|tsearch|search|ousearch|outubesearch)(\s|$)/Si:*: {
n184= $iif($istok(%youtubefetch,$chan,44),halt,noop)
n185= $iif($istok(%nolinks,$nick,44),halt,noop)
n186= if ($($+(
,botflood.,$nick),2)) {
n187= if ($($+(,botflood.,$nick),2) >= 50) {
n188= ignore u60 $address($nick,2)
n189= msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
n190= halt
n191= }
n192= elseif ($($+(
,botflood.,$nick),2) >= 40) {
n193= msg $chan $+($nick,$chr(44)) Please do not flood the bot.
n194= inc -z $+(,botflood.,$nick) 20
n195= halt
n196= }
n197= else { inc -z $+(
,botflood.,$nick) 25 }
n198= }
n199= else { inc -z $+(,botflood.,$nick) 25 }
n200= var %ticks $ticks
n201= if ($2) {
n202= if ($chan) {
n203= if (($left($strip($1),1) == @) &x%x
(_youtube.notices != true)) { set $+(,youtube.,%ticks,.msgtype) msg $chan }
n204= else { set $+(,youtube.,%ticks,.msgtype) notice $nick }
n205= }
n206= else { set $+(
,youtube.,%ticks,.msgtype) msg $nick }
n207= set $+(,youtube.,%ticks,.search) $2
n208= set $+(
,youtube.,%ticks,.query) $urlencode($2-)
n209= sockopen e $+(youtube.,%ticks) www.googleapis.com 443
n210= }
n211= elseif ($2 == $null) {
n212= notice $nick 4Incorrect Syntax - Use10 $1 <search term>
n213= }
n214=}
n215=
n216=on :input::{
n217= $iif($istok(nolinks,$active,44),return,noop)
n218= $iif($istok(%youtubefetch,$active,44),return,noop)
n219= var %ticks $ticks
n220= 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)) {
n221= if ($left($1,1) != /) {
n222= if ($2 != $null) {
n223= set $+(
,youtube.,%ticks,.msgtype) msg $active
n224= set $+(,youtube.,%ticks,.search) $2

n225= set $+(,youtube.,%ticks,.query) $urlencode($2-)
n226= sockopen e $+(youtube.,%ticks) www.googleapis.com 443
n227= }
n228= elseif ($2 == $null) {
n229= .timerYTInputSyntax -m 1 100 echo -at 4Incorrect Syntax - Use10 $1 <search term>
n230= }
n231= }
n232= }
n233= elseif ((youtube.com iswm $1
) || (youtu.be iswm $1-)) {
n234= if ($left($1,1) != /) {
n235= var i 1
n236= while (%i <= $numtok($1-,32)) {
n237= if ((youtube.com iswm $($+($,%i),2)) || (youtu.be iswm $($+($,%i),2))) {
n238= if (/playlist iswm $($+($,%i),2)) { halt }
n239= set $+(
,youtube.,%ticks,.url) $strip($($+($,%i),2))
n240= var tag $($+(,youtube.,%ticks,.url),2)
n241= var tag $iif($numtok(%tag,46) > 1,$gettok(%tag,$calc($numtok(%tag,46)-1) - $numtok(%tag,46),46),%tag)
n242= var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
n243= var %tag $deltok($deltok(%tag,2,35),2,38)
n244= if (youtu.be iswm %tag) { var %tag $gettok(%tag,1,63) }
n245= set $+(
,youtube.,%ticks,.tag) $remove(tag,com/watch?v=,youtube.,$chr(40),$chr(41),?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
n246= }
n247= inc %i
n248= }
n249= if (($($+(
,youtube.,%ticks,.tag),2) _youtube.last) || ($($+(,youtube.,%ticks,.tag),2) $null) || ($($+(,youtube.,%ticks,.tag),2) == com) || (/channel/ iswm $($+(,youtube.,%ticks,.url),2)) || (/user/ iswm $($+(,youtube.,%ticks,.url),2))) {
n250= unset $+(
,youtube.,%ticks,.*)
n251= }
n252= else {
n253= set $+(,youtube.,%ticks,.msgtype) $iif(_youtube.notices == true,echo a,msg $active)
n254= set $+(,youtube.,%ticks,.nick) $nick
n255= set $+(
,youtube.,%ticks,.chan) $chan
n256= set $+(,youtube.,%ticks,.network) $network
n257= sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
n258= }
n259= }
n260= }
n261=}
n262=
n263=#search end
n264=
n265=#parse on
n266=on $*:text:/youtu(.be|be.com)/Si:*: {
n267= $iif($istok(%youtubefetch,$chan,44),halt,noop)
n268= $iif($istok(%nolinks,$nick,44),halt,noop)
n269= if ($($+(
,botflood.,$nick),2)) {
n270= if ($($+(,botflood.,$nick),2) >= 50) {
n271= ignore -u60 $address($nick,2)
n272= msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
n273= halt
n274= }
n275= elseif ($($+(
,botflood.,$nick),2) >= 40) {
n276= msg $chan $+($nick,$chr(44)) Please do not flood the bot.
n277= inc -z $+(,botflood.,$nick) 20
n278= halt
n279= }
n280= else {
n281= inc -z $+(
,botflood.,$nick) 10
n282= }
n283= }
n284= else { inc -z $+(,botflood.,$nick) 10 }
n285= var %i 1
n286= var %ticks $ticks
n287= while (%i <= $numtok($1
,32)) {
n288= if ((youtube.com iswm $($+($,%i),2)) || (youtu.be iswm $($+($,%i),2))) {
n289= if (/playlist iswm $($+($,%i),2)) { halt }
n290= set $+(,youtube.,%ticks,.url) $strip($($+($,%i),2))
n291= var tag $($+(,youtube.,%ticks,.url),2)
n292= var tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
n293= var %tag $deltok($deltok(%tag,2,35),2,38)
n294= if (youtu.be iswm %tag) { var %tag $gettok(%tag,1,63) }
n295= set $+(
,youtube.,%ticks,.tag) $remove(tag,com/watch?v=,youtube.,?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
n296= }
n297= inc %i
n298= }
n299= if ($chan) {
n300= if (
_youtube.notices != true) { set $+(,youtube.,%ticks,.msgtype) msg $chan }
n301= else { set $+(
,youtube.,%ticks,.msgtype) notice $nick }
n302= }
n303= else { set $+(,youtube.,%ticks,.msgtype) msg $nick }
n304= if (($($+(
,youtube.,%ticks,.tag),2) _youtube.last) || ($($+(,youtube.,%ticks,.tag),2) $null) || ($($+(,youtube.,%ticks,.tag),2) == com) || (/channel/ iswm $($+(,youtube.,%ticks,.url),2)) || (/user/ iswm $($+(,youtube.,%ticks,.url),2))) {
n305= unset $+(
,youtube.,%ticks,.*)
n306= }
n307= else {
n308= set $+(,youtube.,%ticks,.nick) $nick
n309= set $+(
,youtube.,%ticks,.chan) $chan
n310= set $+(,youtube.,%ticks,.network) $network
n311= sockopen e $+(youtube.,%ticks) www.googleapis.com 443
n312= }
n313=}
n314=on $*:action:/youtu(.be|be.com)/Si:*: {
n315= $iif($istok(%youtubefetch,$chan,44),halt,noop)
n316= $iif($istok(%nolinks,$nick,44),halt,noop)
n317= if ($($+(
,botflood.,$nick),2)) {
n318= if ($($+(,botflood.,$nick),2) >= 50) {
n319= ignore -u60 $address($nick,2)
n320= msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
n321= halt
n322= }
n323= elseif ($($+(
,botflood.,$nick),2) >= 40) {
n324= msg $chan $+($nick,$chr(44)) Please do not flood the bot.
n325= inc -z $+(,botflood.,$nick) 20
n326= halt
n327= }
n328= else {
n329= inc -z $+(
,botflood.,$nick) 10
n330= }
n331= }
n332= else { inc -z $+(,botflood.,$nick) 10 }
n333= var %i 1
n334= var %ticks $ticks
n335= while (%i <= $numtok($1,32)) {
n336= if ((youtube.com iswm $($+($,%i),2)) || (youtu.be iswm $($+($,%i),2))) {
n337= set $+(
,youtube.,%ticks,.url) $strip($($+($,%i),2))
n338= var tag $($+(,youtube.,%ticks,.url),2)
n339= var tag $iif($numtok(%tag,46) > 1,$gettok(%tag,$calc($numtok(%tag,46)-1) - $numtok(%tag,46),46),%tag)
n340= var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
n341= var %tag $deltok($deltok(%tag,2,35),2,38)
n342= if (youtu.be iswm %tag) { var %tag $gettok(%tag,1,63) }
n343= set $+(
,youtube.,%ticks,.tag) $remove(tag,$chr(40),$chr(41),?,m.,v=,/watch?src_vid=,https://,http://,www.,/v/,youtube.com,youtu.be,youtu.be/,/watch?v=,/watch,?v=,$chr(31),#!,/)
n344= }
n345= inc %i
n346= }
n347= set $+(
,youtube.,%ticks,.msgtype) msg $iif($chan,$v1,$nick)
n348= if (($($+(,youtube.,%ticks,.tag),2) %_youtube.last) || ($($+(,youtube.,%ticks,.tag),2) $null) || ($($+(,youtube.,%ticks,.tag),2) == com) || (/channel/ iswm $($+(,youtube.,%ticks,.url),2)) || (/user/ iswm $($+(,youtube.,%ticks,.url),2))) {
n349= unset $+(
,youtube.,%ticks,.*)
n350= }
n351= else {
n352= set $+(,youtube.,%ticks,.nick) $nick
n353= set $+(
,youtube.,%ticks,.chan) $chan
n354= set $+(,youtube.,%ticks,.network) $network
n355= sockopen e $+(youtube.,%ticks) www.googleapis.com 443
n356= }
n357=}
n358=
n359=#parse end
n360=
n361=on :sockopen:youtube: {
n362= var %ticks $remove($sockname,youtube.)
n363= var %x sockwrite -nt $sockname
n364= if (($($+(
,youtube.,%ticks,.search),2) != $null) && ($($+(,youtube.,%ticks,.round2),2) != true)) {
n365= var %temp_search0 /youtube/v3/search?safeSearch=none&order=relevance&part=snippet&q=
n366= %x GET $+(%temp_search0,$($+(
,youtube.,%ticks,.query),2),&maxResults=,$iif(_youtube.limit == $null,1,_youtube.limit),&key=,$yapi) HTTP/1.1
n367= }
n368= else {
n369= var temp_search1 $(/youtube/v3/videos?part=contentDetails%2Cstatistics%2Csnippet&id=,0)
n370= var %temp_search2 &maxResults=1&fields=items $+ $chr(40) $+ $(contentDetails%2Csnippet%2Cstatistics,0) $+ $chr(41)
n371= %x GET $+(%temp_search1,$($+(
,youtube.,%ticks,.tag),2),%temp_search2,&key=,$yapi) HTTP/1.1
n372= }
n373= x Host: www.googleapis.com
n374= %x $crlf
n375=}
n376=alias nohtml { return $regsubex($$1,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
n377=alias yinfo {
n378= var %step1 errRemoval $gettok($1-,2-,58) errRemoval
n379= return $replace($gettok(%step1,$+(2-,$calc($numtok(%step1,34) - 1)),34),\r\n,$chr(32),\n,$chr(32),\","))
n380=}
n381=on :SOCKREAD:youtube: {
n382= if ($sockerr) { echo a SOCKET ERROR: $sockerr | halt }
n383= else {
n384= var %ticks $gettok($sockname,2,46)
n385= var %sockreader
n386= sockread %sockreader
n387= if (("title": * iswm %sockreader) &x%x
($($+(,youtube.,%ticks,.title),2) == $null)) {
n388= set $+(
,youtube.,%ticks,.title) $yinfo(sockreader)
n389= if ($($+(
,youtube.,%ticks,.search),2) != $null) {
n390= var i 0
n391= while (%i <= $numtok($($+(
,youtube.,%ticks,.search),2),32)) {
n392= inc i
n393= set $+(
,youtube.,%ticks,.title) $regsubex($($+(,youtube.,%ticks,.title),2), /\b( $gettok($($+(,youtube.,%ticks,.search),2),%i,32) )\b/gix, $+($chr(2), \1, $chr(2)))
n394= }
n395= }
n396= ;Badword replacement below--useful for bots that kick on badword list. Replace or add words to censor <word,replacement>
n397= set $+(,youtube.,%ticks,.title) $replace($($+(,youtube.,%ticks,.title),2),faggot,f
***t,nigger,n****r)
n398= }
n399= elseif ("videoId": * iswm sockreader) {
n400= var %temp $ticks
n401= set $+(
,youtube.,%temp,.round2) true
n402= set $+(,youtube.,%temp,.search) $($+(,youtube.,%ticks,.search),2)
n403= set $+(,youtube.,%temp,.query) $($+(,youtube.,%ticks,.query),2)
n404= set $+(,youtube.,%temp,.msgtype) $($+(,youtube.,%ticks,.msgtype),2)
n405= set $+(,youtube.,%temp,.tag) $yinfo(%sockreader)
n406= sockopen -e $+(youtube.,%temp) www.googleapis.com 443
n407= inc $+(
,youtube.,%ticks,.number)
n408= if (_youtube.limit == $($+(,youtube.,%ticks,.number),2)) {
n409= unset $+(,youtube.,$remove($sockname,youtube.),
)
n410= sockclose $sockname
n411= }
n412= }
n413= elseif (channelTitle": * iswm %sockreader) { set $+(,youtube.,%ticks,.user) $yinfo(sockreader) }
n414= elseif (
"duration": * iswm %sockreader) {
n415= 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:]+, )
n416= }
n417= elseif (
"publishedAt": * iswm %sockreader) { set $+(
,youtube.,%ticks,.date) $gettok($yinfo(sockreader),1,84) }
n418= elseif (("description": * iswm %sockreader) &x%x
($($+(,youtube.,%ticks,.description),2) == $null)) {
n419= var %wrong errRemoval ", errRemoval
n420= var %desc $yinfo(%sockreader)
n421= if (($gettok(%sockreader,4,34) $null) || (%desc %wrong)) { set $+(
,youtube.,%ticks,.description) N/A }
n422= else { set $+(,youtube.,%ticks,.description) $iif($numtok(%desc,32) > 10,$+($gettok(%desc,1-8,32),...),%desc) }
n423= }
n424= elseif (
"viewCount": * iswm %sockreader) { set $+(,youtube.,%ticks,.viewcount) $bytes($yinfo(sockreader),bd) }
n425= elseif ("likeCount": * iswm %sockreader) { set $+(
,youtube.,%ticks,.likes) $bytes($yinfo(sockreader),bd) }
n426= elseif (
"dislikeCount": * iswm %sockreader) || (($($+(,youtube.,%ticks,.viewcount),2) != $null) && (}* iswm sockreader)) {
n427= set $+(
,youtube.,%ticks,.dislikes) $bytes($yinfo(sockreader),bd)
n428= set %_youtube.last $($+(
,youtube.,%ticks,.tag),2)
n429= $iif($($+(,youtube.,%ticks,.viewcount),2) == 301,set $+(,youtube.,%ticks,.viewcount) 301+,noop)
n430= var msg 1,0You0,4Tube $x%x
n431= $iif($($+(,youtube.,%ticks,.search),2) == $null,$null,10Link:4 http://youtu.be/ $+ $($+(,youtube.,%ticks,.tag),2)) $&
n432= 2Title:4 $($+(,youtube.,%ticks,.title),2) $x%x
n433= $iif(_youtube.noviews true,$null,2Views:4 $($+(,youtube.,%ticks,.viewcount),2)) $&
n434= $iif(_youtube.nolength true,$null,2Length:4 $($+(,youtube.,%ticks,.time),2)) $&
n435= $iif(_youtube.date true,2Uploaded:4 $($+(,youtube.,%ticks,.date),2),$null) $&
n436= $iif(_youtube.nouser true,$null,10User:4 $($+(,youtube.,%ticks,.user),2)) $&
n437= $iif(_youtube.likes true,10Likes:4 $($+(,youtube.,%ticks,.likes),2),$null) $&
n438= $iif(_youtube.dislikes true,10Dislikes:4 $($+(,youtube.,%ticks,.dislikes),2),$null) $&
n439= $iif(_youtube.description == true,10Description:4 $($+(,youtube.,%ticks,.description),2),$null)
n440= var msg = $remove(%msg,$chr(9))
n441= $($+(
,youtube.,%ticks,.msgtype),2) $iif(_youtube.nocolor == true,$strip(%msg),%msg)
n442= unset $+(
,youtube.,$remove($sockname,youtube.),
)
n443= sockclose $sockname
n444= }
n445= elseif ("totalResults": 0, iswm sockreader) {
n446= var %msg 1,0You0,4Tube 10No relevant results were found. Try different search terms.
n447= $($+(
,youtube.,%ticks,.msgtype),2) $iif(_youtube.nocolor == true,$strip(%msg),%msg)
n448=
n449= unset $+(
,youtube.,$remove($sockname,youtube.),*)
n450= sockclose $sockname
n451= }
n452= elseif ("items": [] iswm sockreader) {
n453= var %msg 1,0You0,4Tube 2This video was removed or is no longer available.
n454= $($+(
,youtube.,%ticks,.msgtype),2) $iif(_youtube.nocolor == true,$strip(%msg),%msg)
n455= unset $+(
,youtube.,$remove($sockname,youtube.),*)
n456= sockclose $sockname
n457= }
n458= }
n459=}
n460=on :sockclose:youtube: { unset $+(%,youtube.,$remove($sockname,youtube.),*) }
n461=on :start: .timerYTUpdate 1 60 yupdate
n462=alias yupdate {
n463= unset %youtube.
| unset %ysearch.*
n464= ;echo -atc info 12[04YouTube12] Checking for updates and clearing variables...
n465= sockopen yupdate hawkee.com 80
n466=}
n467=on :sockopen:yupdate: {
n468= var %x sockwrite -nt $sockname
n469= %x GET /snippet/8577/ HTTP/1.1
n470= %x Host: hawkee.com
n471= %x $crlf
n472=}
n473=on *:SOCKREAD:yupdate: {
n474= if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
n475= sockread %sockreader
n476= if (
<title>* iswm %sockreader) {
n477= var %x $remove($gettok($nohtml(%sockreader),7,32),- mIRC)
n478= if ($yversion != %x) {
n479= echo -atc info 12[04YouTube12] Current: $yversion Latest: %x Status: Please check for updates at http://hawkee.com/snippet/8577/
n480= }
n481= unset %sockreader
n482= sockclose $sockname
n483= }
n484=}


Replies (10)

RE: YouTube scipt - Added by Paul Janson over 4 years ago

It's hard to deal with your question because of 2 issues.

1. it looks like this was created in mirc where the script was created with the .INI filetype. This causes mirc to save it with all those n= lines like you see in servers.ini
Try saving the script to .MRC filetype, or better yet just copypaste from the Alt+R editor instead of using notepad.

2. Your script is full of symbols which the forum interprets as formatting code, so i see a lot of lines being underlined.
here in the reply box you see the button labeled PRE. use that to create the PRE and /PRE labels where you can paste your code between them, so the code shows correctly, including being indented

RE: YouTube scipt - Added by Q Steinberg over 4 years ago

I tried everything you told me, but still doesn't work.

My only problem is still with adding rooms names where I don't want the script to work at. Other than that, the script works perfectly.

Here is the script's page link, if you want to take a look. Thank you.

http://hawkee.com/snippet/8577/

RE: YouTube scipt - Added by Paul Janson over 4 years ago

It looks like the script is incomplete. The dialog has control 64 for the "click here to enter #channel" but does not have anything in the :sclick: section to actually do anything when 64 happens, and same with the "click here" button on the nicks tab. Also, both 'Add' buttons don't seem to do anything except re-display the current state of both variables for nick/chan. Rather than try to figure out exactly what they have in mind, I made a change to the menu you see in the rightclick menu of channel window.

Near line 11, there are 3 lines for a MENU structure. Replace them with the following structure:

menu status,channel,query,nicklist {
  YouTube!
  .YouTube Dialog:youtube
  .$iif( $istok(%nolinks     ,$1   ,32),Enable  nick $1    ):set %nolinks      $remtok(%nolinks     ,$$1  ,32)
  .$iif(!$istok(%nolinks     ,$1   ,32),Disable nick $1    ):set %nolinks      $addtok(%nolinks     ,$$1  ,32)
  .$iif( $istok(%youtubefetch,$chan,32),Enable  chan $chan) :set %youtubefetch $remtok(%youtubefetch,$$chan,32)
  .$iif(!$istok(%youtubefetch,$chan,32),Disable chan $chan) :set %youtubefetch $addtok(%youtubefetch,$$chan,32)
}

This now turns that menu choice into a sub menu, and you'll need a 2nd click to open the dialog.
It now shows enable or disable for the current channel, or the 1st selected nick, depending on whether they're currently in the opposite state. I haven't verified how the script handles these nicks/channels once they're added to the variable, but it does add them to the dialog once you either re-open the dialog or click the ADD button to update the display.

RE: YouTube scipt - Added by Q Steinberg over 4 years ago

It's not working properly.

I added 4 channels (where I don't want the script to work on them), but it is working and sharing YouTube links.

And the the channels appear on the same line (in the dialog box). So the script only works on the first channel added

RE: YouTube scipt - Added by Paul Janson over 4 years ago

Sorry, looks like the variables are tokenized with commas instead of spaces. So change my 32's into 44's.

RE: YouTube scipt - Added by Q Steinberg over 4 years ago

It's working!
Thanks a lot for your time and effort. I really appreciate it

RE: YouTube scipt - Added by Q Steinberg over 4 years ago

Any idea how to change the 'upload date' format?
Because the script shows (year-month-day)
I would like to change it to: (day-month-year)

RE: YouTube scipt - Added by Paul Janson over 4 years ago

The date comes from line 418 of the current hawkee code containing:

$gettok($yinfo(%sockreader),1,84)

so, the $yinfo returns a string, and this gets the beginning of the string until a capital "T" appears. If the string contains a string which $ctime(string) recognizes as a valid date string, you can use $asctime's formatting parameter to make the date appear any way you wish. To test it, put a sample datestring into %a, and practice until you get %d to look the way you like...

//var -s %a 2018/12/31 12:34:56 , %b $ctime(%a) , %c $asctime(%b) , %d $asctime(%b,dd.mm.yyyy HH:nn:ss)

... then use that same format string in:

$asctime($ctime($gettok($yinfo(%sockreader),1,84)),mm.dd.yyyy HH:nn:ss)

If the input datestring is placed into %a but you don't get a valid result in %c or %d, then this date format isn't recognized by AdiIRC, and there might need to be further manipulation needed before you can get $ctime to translate the text into a time-number, from which $asctime whill give you what you want. Note that if you want the time to be displayed as UTF+0, you can try using $gmt instead of $asctime.

RE: YouTube scipt - Added by Q Steinberg over 4 years ago

Thank you very much for your effort and your time.

I want to ask you about MDX.dll

Some scripts wouldn't work without downloading MDX.dll

So, is it safe to use MDX.dll, or would it cause any harm or errors to my AdiIRC ??

RE: YouTube scipt - Added by Paul Janson over 4 years ago

I haven't used MDX much at all, so I dunno. If MDX needs to know the exact version of mirc that's running in order to do some low-level tricks, then it would probably be confused by a client which doesn't look as expected.

Also be aware that all mirc dll's are 32-bit dll's made for a 32-bit executible. So if you do try to use a mirc.dll in AdiIRC, you need to use the 32-bit adiirc.exe too.

    (1-10/10)