Youtube Script (Parse Vids and Search) v6.4

By illhawkthat on Apr 25, 2011

Screenshots

  • YouTube Script (Parse Vids and Search) v6.4
  • Last edit June 20, 2016
  • For help/setup type /YouTube in mIRC

USAGE:

Used to automatically parse links posted in a chat and deliver the info to you.
Also used to search youtube and deliver the information of the best result in a similar fashion.
Youtube youtube youtube, all three in one?

DIRECTIONS:

Tested and works well with mIRC v7.43+
Copy entire code and paste into remote section of a new script (Hit alt+r, File<New, Paste in the copied code, File<Save as "youtube.ini")
Please view the help/settings information found by typing /youtube into mIRC

INFO:

Originally posted on April 25, 2011
I can be contacted via a comment below

CHANGELOG:


--Let me know when its broken//what you want changed.


--Feedback greatly appreciated

;YouTube Script (Parse Vids and Search) v6.4
;Made by nick1
;Last edit June 20, 2016
;For help/setup type /YouTube in mIRC
;2D0 -- You tell me in the comments! http://hawkee.com/snippet/8577/
;EDITS -- Fixed bug where youtube.com would say invalid video (and cleaned up some other code in the parse section)

alias -l yversion { return v6.4 }
alias -l yapi { return AIzaSyBZFSgBuREDKNRwHqvHix68W3WiMyZ3N6c }

menu status,channel,query {
  YouTube:youtube
}

alias YouTube { dialog -m YouTube YouTube }

dialog Youtube {
  title "YouTube v6.4"
  size -1 -1 242 196
  option dbu
  icon $mircdirYoutube.ico, 0
  link "View Script On Hawkee", 1, 3 2 59 8
  button "Exit", 7, 88 181 72 12, cancel
  tab "About", 10, 2 9 235 169
  link "YouTube Script (Parse Vids and Search) v6.4 -- Post Bugs and Feature Requests Here", 24, 16 26 208 8, tab 10
  text "Last updated on June 20 2016", 19, 7 66 95 8, tab 10
  text "Please post suggestions, complaints, or bugs on the hawkee link (or in chat)", 20, 7 37 188 8, tab 10
  text "!commands will notice the user; @commands will be public to the channel", 13, 7 93 175 8, tab 10
  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
  link "Click here to chat (leave a message for nick1)", 66, 58 50 110 8, tab 10
  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
  button "Check for Updates", 21, 102 64 54 12, tab 10
  tab "Basic Options", 2
  box "Search Commands/Options", 60, 7 52 209 29, tab 2
  text "youtube <search terms>; ytsearch <search>; ysearch <search terms>", 62, 10 60 175 8, tab 2
  box "Disable Options", 5, 7 23 209 27, tab 2
  check "Disable Search - Disables search commands below", 11, 11 29 133 10, tab 2 flat
  check "Disable Parse - Disables the script from automatically sending info", 14, 11 38 175 10, tab 2 flat
  box "Output Options", 9, 7 83 209 93, tab 2
  check "Disable Views - Removes 'Views: <Views>'", 15, 11 90 123 10, tab 2
  check "Disable Length - Removes 'Length: <Length>'", 16, 11 99 130 10, tab 2
  check "Disable User - Removes 'User: <User>'", 17, 11 108 113 10, tab 2
  check "Disable Formatting - Removes Colors and Bold", 22, 11 117 127 10, tab 2
  edit "", 58, 99 69 15 10, tab 2 limit 1
  text "Number of search results displayed:", 25, 10 70 87 8, tab 2
  check "Enable Date - Adds 'Uploaded: <Date>'", 57, 11 126 120 10, tab 2
  check "Enable Likes - Adds 'Likes: <Likes>", 27, 11 135 130 10, tab 2
  check "Enable Dislikes - Adds 'Dislikes: <Dislikes>", 28, 11 144 130 10, tab 2
  check "Enable Description - Adds 'Description <Description>", 29, 11 153 139 10, tab 2
  check "Enable Notice Mode (Does Not Message Channel)", 30, 11 163 139 10, tab 2
  tab "Channel Settings", 3
  list 6, 8 56 220 116, tab 3 sort size extsel vsbar
  edit "", 8, 9 26 155 25, tab 3 multi autohs autovs
  text "List of channels the script will NOT run on", 12, 48 50 101 6, tab 3
  button "Add", 4, 190 25 37 12, tab 3
  button "Remove", 63, 190 42 37 12, tab 3
  button "Click here to enter #channels ...", 64, 10 27 153 23, tab 3
  tab "Nick Settings", 26
  text "List of nicks the script will NOT run for", 70, 48 50 101 6, tab 26
  list 71, 8 56 220 116, tab 26 sort size extsel vsbar
  button "Remove", 72, 190 42 37 12, tab 26
  button "Add", 73, 190 25 37 12, tab 26
  edit "", 69, 9 26 155 25, tab 26 multi autohs autovs
  button "Click here to enter Nicks ...", 74, 10 27 153 23, tab 26
  text "This script created by nick1", 18, 171 2 66 8
}

on *:dialog:youtube:init:0: {
  FillChannelBox
  FillNickBox
  $iif(%_youtube.nocolor == true,did -c youtube 22,noop)
  did -a youtube 58 $iif(%_youtube.limit == $null,1,%_youtube.limit)
  $iif(%_youtube.noviews == true,did -c youtube 15,noop)
  $iif(%_youtube.nolength == true,did -c youtube 16,noop)
  $iif(%_youtube.nouser == true,did -c youtube 17,noop)
  $iif(%_youtube.date == true,did -c youtube 57,noop)
  $iif(%_youtube.likes == true,did -c youtube 27,noop)
  $iif(%_youtube.dislikes == true,did -c youtube 28,noop)
  $iif(%_youtube.description == true,did -c youtube 29,noop)
  $iif(%_youtube.notices == true,did -c youtube 30,noop)
  $iif($group(#search) != on,did -c youtube 11,noop)
  $iif($group(#parse) != on,did -c youtube 14,noop)  
}
alias FillChannelBox {
  did -r youtube 6
  var %y 1
  while (%y <= $numtok(%youtubefetch,44)) {
    did -a youtube 6 $gettok(%youtubefetch,%y,44)
    inc %y
  }
}
alias FillNickBox {
  did -r youtube 71
  var %y 1
  while (%y <= $numtok(%nolinks,44)) {
    did -a youtube 71 $gettok(%nolinks,%y,44)
    inc %y
  }
}
on *:dialog:youtube:edit:58: {
  if (($did(58).text < 1) || ($did(58).text !isnum) && ($did(58).text != $null)) {
    did -r youtube 58
    noop $input(Enter a number between 1 and 9, owd, Invalid input!)
  }
  elseif ($did(58).text != $null) { set %_youtube.limit $did(58).text }
}
on *:dialog:youtube:sclick:*: {
  if (($did == 1) || ($did == 24)) { run http://hawkee.com/snippet/8577/ }
  elseif ($did == 66) { server -m irc.rizon.net:6667 -jn #rsbot_help }
  elseif ($did == 22) { set %_youtube.nocolor $iif($did(22).state,true,false) }
  elseif ($did == 15) { set %_youtube.noviews $iif($did(15).state,true,false) }
  elseif ($did == 16) { set %_youtube.nolength $iif($did(16).state,true,false) }
  elseif ($did == 17) { set %_youtube.nouser $iif($did(17).state,true,false) }
  elseif ($did == 57) { set %_youtube.date $iif($did(57).state,true,false) }
  elseif ($did == 27) { set %_youtube.likes $iif($did(27).state,true,false) }
  elseif ($did == 28) { set %_youtube.dislikes $iif($did(28).state,true,false) }
  elseif ($did == 29) { set %_youtube.description $iif($did(29).state,true,false) }
  elseif ($did == 30) { set %_youtube.notices $iif($did(30).state,true,false) }
  elseif ($did == 11) { $iif($group(#search) == on,.disable,.enable) #search }
  elseif ($did == 21) { yupdate }
  elseif ($did == 14) { $iif($group(#parse) == on,.disable,.enable) #parse }
  elseif ($did == 4) {
    set %youtubefetch $addtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
    did -r youtube 8
    FillChannelBox
  }
  elseif ($did == 73) {
    set %nolinks $addtok(%nolinks,$did(69),44)
    did -r youtube 69
    FillNickBox
  }
  elseif ($did == 63) {
    if ($did(8) != $null) {
      set %youtubefetch $remtok(%youtubefetch,$iif(($left($did(8),1) == $chr(35)),$did(8),$+($chr(35),$did(8))),44)
      did -r youtube 8
    }
    if ($did(6).seltext != $null) { set %youtubefetch $remtok(%youtubefetch,$did(6).seltext,44) }
    FillChannelBox
  }
  elseif ($did == 3) { did -t youtube 4 }
  elseif ($did == 26) { did -t youtube 73 }
  elseif ($did == 72) {
    if ($did(69) != $null) {
      set %nolinks $remtok(%nolinks,$did(69),44)
      did -r youtube 69
    }
    if ($did(71).seltext != $null) { set %nolinks $remtok(%nolinks,$did(71).seltext,44) }
    FillNickBox
  }
}

raw 408:*: msg $2 $remove($strip($13-),$chr(9),$chr(8))

alias urlencode { return $replacex($regsubex($$1-,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))),$chr(32),+,$chr(43),%2B) }

on $*:text:/^[!@](disableyt|offyt|disableyoutube|offyoutube)(\s|$)/Si:?: {
  if ($2) {
    if ($me ison $2) {
      if ($nick isop $2) {
        msg $nick 4Youtube has been10 disabled on $+(,$2,)
        set %youtubefetch $addtok(%youtubefetch,$2,44)
      }
      else { msg $nick 4Sorry, you must be an10 op of $+(,$2,) to disable youtube there }
    }
    else { msg $nick 4Sorry, I am not10 currently in $+(,$2,) }
  }
  elseif ($2 == $null) { msg $nick 4Incorrect Syntax - Use10 $1 <#channel> }
}
on $*:text:/^[!@](enableyt|onyt|enableyoutube|onyoutube)(\s|$)/Si:?: {
  if ($2) {
    if ($me ison $2) {
      if ($nick isop $2) {
        msg $nick 4Youtube has been10 enabled on $+(,$2,)
        set %youtubefetch $remtok(%youtubefetch,$2,44)
      }
      else { msg $nick 4Sorry, you must be an10 op of $+(,$2,) to enable youtube there }
    }
    else { msg $nick 4Sorry, I am not10 currently in $+(,$2,) }
  }
  elseif ($2 == $null) { msg $nick 4Incorrect Syntax - Use10 $1 <#channel> }
}

#search on
on $*:text:/^[!@]y(outube|t|tsearch|search|ousearch|outubesearch)(\s|$)/Si:*: {
  $iif($istok(%youtubefetch,$chan,44),halt,noop)
  $iif($istok(%nolinks,$nick,44),halt,noop)
  if ($($+(%,botflood.,$nick),2)) {
    if ($($+(%,botflood.,$nick),2) >= 50) { 
      ignore -u60 $address($nick,2) 
      msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
      halt 
    }
    elseif ($($+(%,botflood.,$nick),2) >= 40) { 
      msg $chan $+($nick,$chr(44)) Please do not flood the bot. 
      inc -z $+(%,botflood.,$nick) 20 
      halt 
    }
    else { inc -z $+(%,botflood.,$nick) 25 }
  }
  else { inc -z $+(%,botflood.,$nick) 25 }
  var %ticks $ticks
  if ($2) {
    if ($chan) {
      if (($left($strip($1),1) == @) && (%_youtube.notices != true)) { set $+(%,youtube.,%ticks,.msgtype) msg $chan }
      else { set $+(%,youtube.,%ticks,.msgtype) notice $nick }
    }
    else { set $+(%,youtube.,%ticks,.msgtype) msg $nick }
    set $+(%,youtube.,%ticks,.search) $2-
    set $+(%,youtube.,%ticks,.query) $urlencode($2-)
    sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  }
  elseif ($2 == $null) { 
    notice $nick 4Incorrect Syntax - Use10 $1 <search term> 
  }
}

on *:input:*:{
  $iif($istok(%nolinks,$active,44),return,noop)
  $iif($istok(%youtubefetch,$active,44),return,noop)
  var %ticks $ticks
  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)) {
    if ($left($1,1) != /) {
      if ($2 != $null) {
        set $+(%,youtube.,%ticks,.msgtype) msg $active
        set $+(%,youtube.,%ticks,.search) $2-
        set $+(%,youtube.,%ticks,.query) $urlencode($2-)
        sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
      }
      elseif ($2 == $null) {
        .timerYTInputSyntax -m 1 100 echo -at 4Incorrect Syntax - Use10 $1 <search term> 
      }
    }
  }
  elseif ((*youtube.com* iswm $1-) || (*youtu.be* iswm $1-)) {
    if ($left($1,1) != /) {
      var %i 1
      while (%i <= $numtok($1-,32)) {
        if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
          if (*/playlist* iswm $($+($,%i),2)) { halt }
          set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
          var %tag $($+(%,youtube.,%ticks,.url),2)
          var %tag $iif($numtok(%tag,46) > 1,$gettok(%tag,$calc($numtok(%tag,46)-1) - $numtok(%tag,46),46),%tag)
          var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
          var %tag $deltok($deltok(%tag,2,35),2,38)
          if (*youtu.be* iswm %tag) { var %tag $gettok(%tag,1,63) }
          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),#!,/)
        }
        inc %i
      }
      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))) {
        unset $+(%,youtube.,%ticks,.*)
      }
      else {
        set $+(%,youtube.,%ticks,.msgtype) $iif(%_youtube.notices == true,echo -a,msg $active)
        set $+(%,youtube.,%ticks,.nick) $nick
        set $+(%,youtube.,%ticks,.chan) $chan
        set $+(%,youtube.,%ticks,.network) $network
        sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
      }
    }
  }
}

#search end

#parse on
on $*:text:/youtu(.be|be.com)/Si:*: {
  $iif($istok(%youtubefetch,$chan,44),halt,noop)
  $iif($istok(%nolinks,$nick,44),halt,noop)
  if ($($+(%,botflood.,$nick),2)) {
    if ($($+(%,botflood.,$nick),2) >= 50) { 
      ignore -u60 $address($nick,2) 
      msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot. 
      halt 
    }
    elseif ($($+(%,botflood.,$nick),2) >= 40) {
      msg $chan $+($nick,$chr(44)) Please do not flood the bot.  
      inc -z $+(%,botflood.,$nick) 20 
      halt 
    }
    else { 
      inc -z $+(%,botflood.,$nick) 10 
    }
  }
  else { inc -z $+(%,botflood.,$nick) 10 }
  var %i 1
  var %ticks $ticks
  while (%i <= $numtok($1-,32)) {
    if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
      if (*/playlist* iswm $($+($,%i),2)) { halt }
      set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
      var %tag $($+(%,youtube.,%ticks,.url),2)
      var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
      var %tag $deltok($deltok(%tag,2,35),2,38)
      if (*youtu.be* iswm %tag) { var %tag $gettok(%tag,1,63) }
      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),#!,/)
    }
    inc %i
  }
  if ($chan) {
    if (%_youtube.notices != true) { set $+(%,youtube.,%ticks,.msgtype) msg $chan }
    else { set $+(%,youtube.,%ticks,.msgtype) notice $nick }
  }
  else { set $+(%,youtube.,%ticks,.msgtype) msg $nick }
  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))) {
    unset $+(%,youtube.,%ticks,.*)
  }
  else {
    set $+(%,youtube.,%ticks,.nick) $nick
    set $+(%,youtube.,%ticks,.chan) $chan
    set $+(%,youtube.,%ticks,.network) $network
    sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  }
}
on $*:action:/youtu(.be|be.com)/Si:*: {
  $iif($istok(%youtubefetch,$chan,44),halt,noop)
  $iif($istok(%nolinks,$nick,44),halt,noop)
  if ($($+(%,botflood.,$nick),2)) {
    if ($($+(%,botflood.,$nick),2) >= 50) { 
      ignore -u60 $address($nick,2) 
      msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot. 
      halt 
    }
    elseif ($($+(%,botflood.,$nick),2) >= 40) {
      msg $chan $+($nick,$chr(44)) Please do not flood the bot.  
      inc -z $+(%,botflood.,$nick) 20 
      halt 
    }
    else { 
      inc -z $+(%,botflood.,$nick) 10 
    }
  }
  else { inc -z $+(%,botflood.,$nick) 10 }
  var %i 1
  var %ticks $ticks
  while (%i <= $numtok($1-,32)) {
    if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
      set $+(%,youtube.,%ticks,.url) $strip($($+($,%i),2))
      var %tag $($+(%,youtube.,%ticks,.url),2)
      var %tag $iif($numtok(%tag,46) > 1,$gettok(%tag,$calc($numtok(%tag,46)-1) - $numtok(%tag,46),46),%tag)
      var %tag $iif($matchtok(%tag,v=,1,38),$v1,%tag)
      var %tag $deltok($deltok(%tag,2,35),2,38)
      if (*youtu.be* iswm %tag) { var %tag $gettok(%tag,1,63) }
      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),#!,/)
    }
    inc %i
  }
  set $+(%,youtube.,%ticks,.msgtype) msg $iif($chan,$v1,$nick)
  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))) {
    unset $+(%,youtube.,%ticks,.*)
  }
  else {
    set $+(%,youtube.,%ticks,.nick) $nick
    set $+(%,youtube.,%ticks,.chan) $chan
    set $+(%,youtube.,%ticks,.network) $network
    sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  }
}

#parse end

on *:sockopen:youtube*: { 
  var %ticks $remove($sockname,youtube.)
  var %x sockwrite -nt $sockname
  if (($($+(%,youtube.,%ticks,.search),2) != $null) && ($($+(%,youtube.,%ticks,.round2),2) != true)) {
    var %temp_search0 /youtube/v3/search?safeSearch=none&order=relevance&part=snippet&q=
    %x GET $+(%temp_search0,$($+(%,youtube.,%ticks,.query),2),&maxResults=,$iif(%_youtube.limit == $null,1,%_youtube.limit),&key=,$yapi) HTTP/1.1
  }
  else {
    var %temp_search1 $(/youtube/v3/videos?part=contentDetails%2Cstatistics%2Csnippet&id=,0)
    var %temp_search2 &maxResults=1&fields=items $+ $chr(40) $+ $(contentDetails%2Csnippet%2Cstatistics,0) $+ $chr(41)
    %x GET $+(%temp_search1,$($+(%,youtube.,%ticks,.tag),2),%temp_search2,&key=,$yapi) HTTP/1.1
  }
  %x Host: www.googleapis.com
  %x $crlf
}
alias nohtml { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
alias yinfo {
  var %step1 errRemoval $gettok($1-,2-,58) errRemoval
  return $replace($gettok(%step1,$+(2-,$calc($numtok(%step1,34) - 1)),34),\r\n,$chr(32),\n,$chr(32),\","))
}
on *:SOCKREAD:youtube*: { 
  if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  else {
    var %ticks $gettok($sockname,2,46)
    var %sockreader
    sockread %sockreader
    if ((*"title": * iswm %sockreader) && ($($+(%,youtube.,%ticks,.title),2) == $null)) {
      set $+(%,youtube.,%ticks,.title) $yinfo(%sockreader)
      if ($($+(%,youtube.,%ticks,.search),2) != $null) {
        var %i 0
        while (%i <= $numtok($($+(%,youtube.,%ticks,.search),2),32)) {
          inc %i
          set $+(%,youtube.,%ticks,.title) $regsubex($($+(%,youtube.,%ticks,.title),2), /\b( $gettok($($+(%,youtube.,%ticks,.search),2),%i,32) )\b/gix, $+($chr(2), \1, $chr(2)))
        }
      }
      ;Badword replacement below--useful for bots that kick on badword list. Replace or add words to censor <word,replacement>
      set $+(%,youtube.,%ticks,.title) $replace($($+(%,youtube.,%ticks,.title),2),faggot,f****t,nigger,n****r)
    }
    elseif (*"videoId": * iswm %sockreader) {
      var %temp $ticks
      set $+(%,youtube.,%temp,.round2) true
      set $+(%,youtube.,%temp,.search) $($+(%,youtube.,%ticks,.search),2)
      set $+(%,youtube.,%temp,.query) $($+(%,youtube.,%ticks,.query),2)
      set $+(%,youtube.,%temp,.msgtype) $($+(%,youtube.,%ticks,.msgtype),2)
      set $+(%,youtube.,%temp,.tag) $yinfo(%sockreader)
      sockopen -e $+(youtube.,%temp) www.googleapis.com 443
      inc $+(%,youtube.,%ticks,.number)
      if (%_youtube.limit == $($+(%,youtube.,%ticks,.number),2)) {
        unset $+(%,youtube.,$remove($sockname,youtube.),*)
        sockclose $sockname
      }
    }
    elseif (*channelTitle": * iswm %sockreader) { set $+(%,youtube.,%ticks,.user) $yinfo(%sockreader) }
    elseif (*"duration": * iswm %sockreader) { 
      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:]+, )
    }
    elseif (*"publishedAt": * iswm %sockreader) { set $+(%,youtube.,%ticks,.date) $gettok($yinfo(%sockreader),1,84) }
    elseif ((*"description": * iswm %sockreader) && ($($+(%,youtube.,%ticks,.description),2) == $null)) {
      var %wrong errRemoval ", errRemoval
      var %desc $yinfo(%sockreader)
      if (($gettok(%sockreader,4,34) == $null) || (%desc == %wrong)) { set $+(%,youtube.,%ticks,.description) N/A }
      else { set $+(%,youtube.,%ticks,.description) $iif($numtok(%desc,32) > 10,$+($gettok(%desc,1-8,32),...),%desc) }
    }
    elseif (*"viewCount": * iswm %sockreader) { set $+(%,youtube.,%ticks,.viewcount) $bytes($yinfo(%sockreader),bd) }
    elseif (*"likeCount": * iswm %sockreader) { set $+(%,youtube.,%ticks,.likes) $bytes($yinfo(%sockreader),bd) } 
    elseif (*"dislikeCount": * iswm %sockreader) || (($($+(%,youtube.,%ticks,.viewcount),2) != $null) && (*}* iswm %sockreader)) { 
      set $+(%,youtube.,%ticks,.dislikes) $bytes($yinfo(%sockreader),bd)
      set %_youtube.last $($+(%,youtube.,%ticks,.tag),2)
      $iif($($+(%,youtube.,%ticks,.viewcount),2) == 301,set $+(%,youtube.,%ticks,.viewcount) 301+,noop)
      var %msg 1,0You0,4Tube $&
        $iif($($+(%,youtube.,%ticks,.search),2) ==  $null,$null,10Link:4 http://youtu.be/ $+ $($+(%,youtube.,%ticks,.tag),2)) $&
        10Title:4 $($+(%,youtube.,%ticks,.title),2) $&
        $iif(%_youtube.noviews == true,$null,10Views:4 $($+(%,youtube.,%ticks,.viewcount),2)) $&
        $iif(%_youtube.nolength == true,$null,10Length:4 $($+(%,youtube.,%ticks,.time),2)) $&
        $iif(%_youtube.date == true,10Uploaded:4 $($+(%,youtube.,%ticks,.date),2),$null) $&
        $iif(%_youtube.nouser == true,$null,10User:4 $($+(%,youtube.,%ticks,.user),2)) $&
        $iif(%_youtube.likes == true,10Likes:4 $($+(%,youtube.,%ticks,.likes),2),$null) $&
        $iif(%_youtube.dislikes == true,10Dislikes:4 $($+(%,youtube.,%ticks,.dislikes),2),$null) $&
        $iif(%_youtube.description == true,10Description:4 $($+(%,youtube.,%ticks,.description),2),$null)
      var %msg = $remove(%msg,$chr(9))
      $($+(%,youtube.,%ticks,.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
      unset $+(%,youtube.,$remove($sockname,youtube.),*)
      sockclose $sockname
    }
    elseif (*"totalResults": 0,* iswm %sockreader) {
      var %msg 1,0You0,4Tube 10No relevant results were found. Try different search terms.
      $($+(%,youtube.,%ticks,.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)

      unset $+(%,youtube.,$remove($sockname,youtube.),*)
      sockclose $sockname
    }
    elseif (*"items": []* iswm %sockreader) {
      var %msg 1,0You0,4Tube 10This video was removed or is no longer available.
      $($+(%,youtube.,%ticks,.msgtype),2) $iif(%_youtube.nocolor == true,$strip(%msg),%msg)
      unset $+(%,youtube.,$remove($sockname,youtube.),*)
      sockclose $sockname
    }
  }
}
on *:sockclose:youtube*: { unset $+(%,youtube.,$remove($sockname,youtube.),*) }
on *:start: .timerYTUpdate 1 60 yupdate
alias yupdate {
  unset %youtube.* | unset %ysearch.*
  ;echo -atc info 12[04YouTube12] Checking for updates and clearing variables...
  sockopen yupdate hawkee.com 80
}
on *:sockopen:yupdate: {  
  var %x sockwrite -nt $sockname
  %x GET /snippet/8577/ HTTP/1.1
  %x Host: hawkee.com
  %x $crlf
}
on *:SOCKREAD:yupdate: { 
  if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  sockread %sockreader
  if (*<title>* iswm %sockreader) {
    var %x $remove($gettok($nohtml(%sockreader),7-,32),- mIRC)
    if ($yversion != %x) {
      echo -atc info 12[04YouTube12] Current: $yversion Latest: %x Status: Please check for updates at http://hawkee.com/snippet/8577/
    }
    unset %sockreader
    sockclose $sockname
  }
}

--Let me know when its broken//what you want changed.


--Feedback greatly appreciated

Comments

Sign in to comment.
AddictedtoFootballManager   -   12 hours 54 mins ago

Would it be possible to do a "don't operate for this username or ip range etc" sort of like how channel bans work etc? Because certain annoying users can just change their nick to get around the current ignores and you have to manually add their new nick in.

 Respond  
Spasman   -  Jul 24, 2017

I think I found a bug: If you make a search and your first result is a channel, it won't return the result (at least if you have it set to only returning 1 result)

For example, if you enter a big shot youtuber's name like PewdiePie, his channel will come first before any videos and the script won't return anything. http://i.imgur.com/5Dv5lqW.png

 Respond  
xplo   -  May 24, 2017

This script is amazing :) Keep it up

illhawkthat  -  Jul 18, 2017

Glad you like it!

Sign in to comment

AddictedtoFootballManager   -  Jan 26, 2017

It doesn't seem to work any more?

I get in my status window

  • /sockwrite: 'youtube.820356218' not connected (line 372, youtube64.mrc)
  • /sockwrite: 'youtube.820635765' not connected (line 372, youtube64.mrc)
  • /sockwrite: 'youtube.829207390' not connected (line 372, youtube64.mrc)
  • /sockwrite: 'youtube.843740531' not connected (line 372, youtube64.mrc)
  • /sockwrite: 'youtube.843888546' not connected (line 372, youtube64.mrc)
illhawkthat  -  May 10, 2017

Hi @AddictedtoFootballManager sorry for the late reply! It is working for me. Can you please share the version of mIRC you are using?

Sign in to comment

FabianH   -  Aug 24, 2016

@illhawkthat

on a channel that has another bot that does youtube script. the bot says in response to youtube link the folliowing: at (www.youtube.com)
now your script triggers on that aswell, using version 6.4

as seen here: http://prntscr.com/c9yaee (screenshot link to display the error) (the 2 times each is because i private messaged myself.
maybe this is a better example: http://prntscr.com/c9ydgm (shouldnt it just only trigger on a youtube watch link? instead of on the URL itself?)

how can i fix this?

illhawkthat  -  Aug 30, 2016

@FabianH thanks for letting me know about this. I thought I fixed that in this version, but I might have made it worse. For now, just ignore the other bot's username - I'm working on a fix for this but it's a little tricky. I'll get back to you in a little while!

FabianH  -  Aug 31, 2016

thank you for looking into it :)

Sign in to comment

illhawkthat   -  Jun 30, 2016

Hi @Alejandro I can help you, I went ahead and started a new thread so Villano doesn't get the notifications. What are you having trouble with on the script? These are the basic setup instructions:Hit alt+r, File<New, Paste in the copied code, File<Save as "youtube.ini"

Once you've done that, let me know what happens when you type /youtube or if someone pastes in a youtube link.

Alejandro  -  Jun 30, 2016

Hi @illhawkthat In what number should i start copy the code? 8, 11 or 15? Which one alias -l yversion { return v6.4 }
alias -l yapi { return AIzaSyBZFSgBuREDKNRwHqvHix68W3WiMyZ3N6c }

menu status,channel,query {
YouTube:youtube
}

alias YouTube { dialog -m YouTube YouTube }

illhawkthat  -  Jun 30, 2016

Start from line 1 to include everything.

Alejandro  -  Jun 30, 2016

Ok, i copy all of it, from line 1, but when i paste a youtube link, it didnt do nothing, or i have to activate it or something?

Alejandro  -  Jul 01, 2016

Can it show by link or just search? Cuz when i paste a link, it didn't show the title, some thing is wrong, look it says on my mirc

  • Invalid format: $ (line 292, youtube.ini)

I did everything whay you said

This is line 292 var %tag $($+(%,youtube.,%ticks,.url),2)

Something is wrong i guess

illhawkthat  -  Jul 01, 2016

Huh... Haven't seen the script fail in that section before. What version of mIRC are you using? Leave the server/channel/nick you are running the script on and I will try to come by to troubleshoot

Alejandro  -  Jul 01, 2016

I have mirc 6.2 i'm on irc.chathispano.com room #lc-brasil can you come now?

Alejandro  -  Jul 02, 2016

What happen? You left last night and do this script work with other links? Or just YouTube links?

illhawkthat  -  Jul 03, 2016

@Alejandro sorry about that I somehow got G-lined from the network...
Ataques a canales. Para mas informacion visite http://www.chathispano.com/gline/?id=4733638 (expires at Dom, 17/07/2016 06:29:15 +0200).

It's just youtube links for this one. Hope everything is working well for you now! (in case anyone else has this same error, upgrade your mirc to v7.43+)

Alejandro  -  Jul 03, 2016

Ah ok, don't worry, sometimes it happen to me too, that's weird g-lined, ataques a canales means channel attacks, maybe you log in the network with some kind of proxy or your nick, you should have been log in with a name, they have some rules there, but i don't remember about that, it would be more great if it work on any links like Google, Yahoo, CNN. But this script is good, it has everything like the User, Likes, Dislikes and Description. My mirc 6.2 was too old, but now is working well, thank you man, but when someone paste a link, it kind of slow showing the title, why is that? Lag or my internet is slow?

illhawkthat  -  Jul 07, 2016

@Alejandro that must be lag on your computer or internet connection. With a good connection, it should respond within 1 second of the text.

Alejandro  -  Jul 14, 2016

Ok and do this script respond 2 times or more with the same link? You know what i mean, cuz some other youtube script ignore you for repeating (Pasting) the same youtube link

illhawkthat  -  Jul 15, 2016

Yes, it has flood protection on a per nick basis as well as duplicate link detection.

Alejandro  -  Jul 19, 2016

Ok, but how i turn off the flood protection?

illhawkthat  -  Jul 20, 2016

Sorry, you can't turn it off using the built in settings. If you'd like to manually erase you can look for the "botflood" lines to erase. How come you want to turn it off?

Alejandro  -  Jul 20, 2016

Cuz my internet is not very good, is slow and people want to see the title again, some people missed it and what line is the botflood?

Alejandro  -  Jul 20, 2016

I found it, but which line should i erase

parse on

on $:text:/youtu(.be|be.com)/Si:: {
$iif($istok(%youtubefetch,$chan,44),halt,noop)
$iif($istok(%nolinks,$nick,44),halt,noop)
if ($($+(%,botflood.,$nick),2)) {
if ($($+(%,botflood.,$nick),2) >= 50) {
ignore -u60 $address($nick,2)
msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
halt
}
elseif ($($+(%,botflood.,$nick),2) >= 40) {
msg $chan $+($nick,$chr(44)) Please do not flood the bot.
inc -z $+(%,botflood.,$nick) 20
halt
}
else {
inc -z $+(%,botflood.,$nick) 10
}

Alejandro  -  Jul 28, 2016

Forget the botflood, if you don't wanna tell me, i see theres another option, !ytsearch, how do the !ytsearch work?

illhawkthat  -  Aug 28, 2016

Hey sorry about the late reply! For some reason didn't see these notices. Erase all the botflood lines
if ($($+(%,botflood.,$nick),2)) {
if ($($+(%,botflood.,$nick),2) >= 50) {
ignore -u60 $address($nick,2)
msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
halt
}
elseif ($($+(%,botflood.,$nick),2) >= 40) {
msg $chan $+($nick,$chr(44)) Please do not flood the bot.
inc -z $+(%,botflood.,$nick) 20
halt
}
else {
inc -z $+(%,botflood.,$nick) 10
}

!ytsearch is used to search youtube try <!ytsearch hello> to get the video for hello

Alejandro  -  Dec 21, 2016

Ok, but how i change the !ytsearch title to show it on the general room? To msg in the room, i cant find the line, I dont want the search in notice

Alejandro  -  Dec 21, 2016

@illhawkthat please reply fast

Sign in to comment

LobsterMan   -  Jun 07, 2016

For some reason, in some channels, if there is another youtube bot, really long cascades of parsed messages will result:

[10:49:34] LobsterMan> https://www.youtube.com/watch?v=xysDK81S8bQ
[10:49:35] magaly> Video title: Floodings in France: french cops are on a small boat and they kind of fail! | Views: 5333 | Likes: 34 (100%) | Dislikes: 0 (0%) | Comments: 14 | Publisher: ZaoualiYoucef
[10:49:36] LobsterMan> YouTube Title: Floodings in France: french cops are on a small boat and they kind of fail! Views: 5,333 Length: 1:51 Uploaded: 2016-06-06 Likes: 34 Dislikes: 0
[10:49:36] magaly> [ Floodings in France: french cops are on a small boat and they kind of fail! - YouTube ] - www.youtube.com
[10:49:38] LobsterMan> YouTube This video was removed or is no longer available.

It seems that www.youtube.com may be triggering a failed parse, but there appears to be more going on here as well that I can't quite figure out

dma  -  Jun 10, 2016

all you have to do is thia click on album coner slick share and you get like this -

NowPlaying The Greeks Don't Want No Freaks by Eagles

you can color to it but i it in /meNowPlaying The Greeks Don't Want No Freaks by Eagles
lolo thats the best way i know ,,, irc.axon.pw #irc me is dma thanks take care

illhawkthat  -  Jun 20, 2016

@LobsterMan looks like I had some sloppy coding in 6.3 that caused the script to trigger with [youtube.com]. This should be fixed in 6.4 let me know if any new bugs pop up. Thanks for pointing this out!
And @dma ... Think you posted in the wrong thread haha

DashRipr0ck  -  Jun 25, 2016

I love, love, love this script! The updates are very appreciated!
Thanks @illhawkthat

Sign in to comment

NoKz   -  May 28, 2016

First and foremost, AMAZING script. Thank you very much for it! Small question; I'm working on this for Twitch and I'm trying to limit it to Mods and subscribers only requesting links. But, I want it to announce links posted in chat for everyone. What do I need to insert to make this work? Thank you!

illhawkthat  -  May 28, 2016

Can you link to a screenshot of what the IRC chan that you run it in (of your twitch channel) looks like? I'm not sure how they distinguish between subscribers and mods on the backend.

NoKz  -  May 28, 2016

https://www.twitch.tv/crream

It's for a Twitch IRC Channel. I've found some stuff saying for subs, you check by calling "($hget(subscribers,$nick) = 1)"

NoKz  -  May 28, 2016

I got it working by adding:

   if ($nick isop #) || (subscriber=1 isin $msgtags) {

To the below entry in the script.

on $*:text:/^[!!]y(outube|t|tsearch|search|ousearch|outubesearch)(\s|$)/Si:#: {
 $iif($istok(%youtubefetch,$chan,44),halt,noop)
 $iif($istok(%nolinks,$nick,44),halt,noop)
   if ($nick isop #) || (subscriber=1 isin $msgtags) {
 if ($($+(%,botflood.,$nick),2)) {
 if ($($+(%,botflood.,$nick),2) >= 50) { 
      ignore -u60 $address($nick,2) 
      msg $chan $+($nick,$chr(44)) You have been put on ignore for 60secs for abusing the bot.
     ;halt 
    }
    elseif ($($+(%,botflood.,$nick),2) >= 40) { 
      msg $chan $+($nick,$chr(44)) Please do not flood the bot. 
      inc -z $+(%,botflood.,$nick) 20 
      halt 
    }
    else { inc -z $+(%,botflood.,$nick) 25 }
  }
  else { inc -z $+(%,botflood.,$nick) 25 }
  var %ticks $ticks

  if ($2) {
    if ($chan) {
      if (($left($strip($1),1) == !) && (%_youtube.notices != true)) { set $+(%,youtube.,%ticks,.msgtype) msg $chan }
      else { set $+(%,youtube.,%ticks,.msgtype) notice $nick }
    }
    else { set $+(%,youtube.,%ticks,.msgtype) msg $nick }
    set $+(%,youtube.,%ticks,.search) $2-
    set $+(%,youtube.,%ticks,.query) $urlencode($2-)
    sockopen -e $+(youtube.,%ticks) www.googleapis.com 443
  }
  elseif ($2 == $null) { 
    notice $nick Incorrect Syntax - Use $1 <search term> 
  }
}
}
illhawkthat  -  May 28, 2016

Great glad you got it working

Sign in to comment

TheDukez   -  Apr 21, 2016

In setup, I have set to only display one search result with the !youtube command, but it displays four search result links and they are all the same, will there be a fix for this in the next release Please?
] <~TheDukez> !youtube Game of Thrones
[8:10am] Bot YouTube Link: http://youtu.be/EI0ib1NErqg Title: Game of Thrones Season 6: Trailer #2 (HBO) Views: 15,633,948 Length: 2:04 Uploaded: 2016-04-11 User: GameofThrones Likes: 110,784 Dislikes: 1,982
[8:10am] Bot YouTube Link: http://youtu.be/EI0ib1NErqg Title: Game of Thrones Season 6: Trailer #2 (HBO) Views: 15,633,948 Length: 2:04 Uploaded: 2016-04-11 User: GameofThrones Likes: 110,784 Dislikes: 0
[8:10am] Bot YouTube Link: http://youtu.be/EI0ib1NErqg Title: Game of Thrones Season 6: Trailer #2 (HBO) Views: 15,633,948 Length: 2:04 Uploaded: 2016-04-11 User: GameofThrones Likes: 110,784 Dislikes: 0
[8:10am] Bot YouTube Link: http://youtu.be/EI0ib1NErqg Title: Game of Thrones Season 6: Trailer #2 (HBO) Views: 15,633,948 Length: 2:04 Uploaded: 2016-04-11 User: GameofThrones Likes: 110,784 Dislikes: 0

I'm using version mIRC 7.42

Thanks in advance :)

edit: thanks it is now fixed in version 6.3 :)

illhawkthat  -  May 06, 2016

@TheDukez should be fixed in v6.3 thanks for pointing this out!

Sign in to comment

Feldegast   -  Apr 19, 2016

if someone posts a link like this.....
https://www.youtube.com/channel/UCX6b17PVsYBQ0ip5gyeme-Q
the script returns the following
YouTube This video was removed or is no longer available.
as it is a channel and not an actual video could this error message not be shown?

great script! i have been using the script for months and it has been of great use!!

illhawkthat  -  Apr 19, 2016

Great point! Thanks for finding that. I'll make sure to fix that in the next version. @Vegito @LobsterMan @Feldegast just wanted to give an update sorry for the delay in updates, working on a personal project that wraps up on Sunday April 24th so should be getting to it next week.

illhawkthat  -  May 06, 2016

Fixed in v6.3!

Sign in to comment

ViLLaNo-   -  Mar 26, 2016

bro... i've got mIRC v7.32... i've copied and pasted the code and saved like says uphere... but when i paste or anybody paste a link... it doesn't show the script action... :(

illhawkthat  -  Mar 26, 2016

@ViLLaNo- If you have earlier than v7.35 you will need to either update your client or download an OpenSSL library for compatibility. Ref. http://www.mirc.com/ssl.html
Let me know if updating your client or downloading OpenSSL doesn't fix this for you. The new youtube API requires sockets to be over SSL.

ViLLaNo-  -  Mar 26, 2016

that's happens when i install mirc 7.44

19:19                @ViLLaNo- ¦ https://www.youtube.com/watch?v=g_uoH6hJilc
19:19 :      +NegroMaLo ¦ https://www.youtube.com/watch?v=g_uoH6hJilc

  • /sockopen: 'youtube.7847989' socket in use (line 259, youtube.mrc)
    19:19 <+NegroMaLo> YouTube Title: Years & Years - King (Official Video) Views: 136,694,824 Length: 3:55 Likes: 652,741

don't read others links, just the link posted with the nick with the script

illhawkthat  -  Mar 26, 2016

It looks like you and someone else posted the same link at the same time so the script parsed the first occurence and not the second one. Unless it's doing that every time? Let me know server/channel if you want me to come debug

ViLLaNo-  -  Mar 26, 2016

it still happens... in every chan... i'm on irc hispano in #uruguay and #xpresion-latina

22:59 ?              +ViLLaNo- ¦ https://www.youtube.com/watch?v=UqLRqzTp6Rk

  • /sockopen: 'youtube.21023037' socket in use (line 260, youtube.mrc)
    22:59 <+ViLLaNo-> YouTube Title: Muse - Psycho [Official Lyric Video] Views: 31,071,861 Length: 5:51 Likes: 253,513
ViLLaNo-  -  Mar 26, 2016

i've fixed it, thanks for the help, it was a number wrong don't worry

illhawkthat  -  Mar 27, 2016

Great, glad you got it working!

Alejandro  -  Jun 29, 2016

Can someone help me? I don't understand this, i need to copy all that in my script?

Alejandro  -  Jun 29, 2016

I copy all that in my mirc and it didn't work, anyone know what is the problem?

Sign in to comment

Vegito   -  Mar 07, 2016
[YouTube] Checking for updates and clearing variables...
[YouTube] Current: v6.2 Latest: v6.2 Status: Up to date

It's very annoying to see this everytime I start mIRC.

Could you make this happen in the background, and only show a message if there is an update. Because I don't need to know everytime that my script is already up to date.

illhawkthat  -  Mar 10, 2016

@Vegito , Good call. I'll make that change in the next update. Thanks for the feedback

illhawkthat  -  May 06, 2016

Fixed in v6.3!

Sign in to comment

LobsterMan   -  Feb 01, 2016

Something I noticed with 6.2:

https://www.youtube.com/watch?v=1q6OpWW_dw0&feature=youtu.be will say video removed
https://www.youtube.com/watch?v=1q6OpWW_dw0 works just fine

illhawkthat  -  Feb 06, 2016

Thanks, I'm on it.

illhawkthat  -  May 06, 2016

Fixed in v6.3!

Sign in to comment

dma   -  Dec 26, 2015

how do i change the colors?

dma  -  Dec 26, 2015

I got it thanks

Sign in to comment

Hazem   -  Nov 10, 2015

@illhawkthat , this is such a brilliant script! Allow me to thank you, and to tell you WELL DONE!
I have one question (or one request)... Do you know -or can you make- a script that is similar to this YouTube script, but would work for Wikipedia searching?
What I'm talking about is a script for normal users (and not just for ChanOPs or Bots), so that when I or any user in the room type: !wiki AnySubject - the result from me would be be a brief line from Wikipedia; telling informations about that AnySubject.
Exactly like this YouTube script. But instead of typing a YouTube link, we would type !wiki AnySubject. And instead of showing informations about the YouTube link, it would show a one-line information from Wikipedia.
I tried to find a script like that, but couldn't find any. The ones available are just for ChanOPs and Bots.

illhawkthat  -  May 07, 2016

Good idea! Here you go, http://hawkee.com/snippet/17017/

Sign in to comment

lakecityransom   -  Nov 04, 2015

Can you make a channels section for what it IS supposed to work on vs. what is is NOT supposed to work on? That seems way more logical and scalable. Every time I join a channel I have to be worried about blocking it out in the script.

illhawkthat  -  Nov 04, 2015

Thanks for the feedback @lakecityransom - One challenge to implement that would to keep people's past settings. For the next update, I'll look at splitting the channels view for a whitelist mode and a blacklist mode because I agree a lot of people use it only on specific channels.
I'll keep you updated!

lakecityransom  -  Nov 04, 2015

TY, also I am having some bizarre issue. I simply load the script and it works out of the box on my main machine. I try to run it on an extra box, copy over my mIRC files 1:1 and only change the nickname and it does not work. It just behaves like this (this log from the bot's perspective):
[09:55] Ransom> https://www.youtube.com/watch?v=YajwIM3EH_A
[09:56] YouTube] Checking for updates and clearing variables...
[09:56] YouTube] Current: v6.2 Latest: v6.2 Status: Up to date
[09:57] Ransom> https://www.youtube.com/watch?v=YajwIM3EH_A
[09:57] Ransom> http://www.youtube.com/watch?v=YajwIM3EH_A
[09:59] Ransom> http://www.youtube.com/watch?v=YajwIM3EH_A
[09:59] Ransom> https://www.youtube.com/watch?v=YajwIM3EH_A
[10:00] YoutubeBot> https://www.youtube.com/watch?v=YajwIM3EH_A
[10:00] YouTube] Checking for updates and clearing variables...
[10:00] YouTube] Current: v6.2 Latest: v6.2 Status: Up to date
[10:00] YoutubeBot> https://www.youtube.com/watch?v=YajwIM3EH_A

rebel9  -  Nov 06, 2015

Don't waste your time illhawkthat, it's setup correctly. This script is meant for a bot, not to be run on your machine. Grab an ec2 instance and throw up windows RDP. Or at least run another instance on a VM, laptop, whatever.

illhawkthat  -  Nov 14, 2015

@lakecityransom it looks like something may be causing the script to restart. Make sure it's loaded in it's own file. Also, keep in mind that the script will not parse the same link in a row (from your log it's all the same video) - this is part of the flood protection system. Let me know if there is anything else I can help with!

Sign in to comment

DashRipr0ck   -  Nov 03, 2015

I LOVE this script and thank you for updating it. There are many chatters I know who use this script for their rooms- as do I.

illhawkthat  -  Nov 03, 2015

Happy to hear that! Let me know if you'd like anything else changed, I love that it's useful for a lot of people.

Sign in to comment

ovelayer   -  Oct 13, 2015

one thing i noted is that this script creates and leave's a bunch of var's...
anyway to clean those once the script is done msgin the output?

illhawkthat  -  Oct 13, 2015

So sorry about that! Try this:

alias clearvars  { var %t $calc($var(%youtube.*,0) + $var(%botflood*,0) + $var(%url*,0) + $var(%ysearch.*,0) + $var(%website.*,0) + $var(%sockreader,0)) | unset %sockreader | unset %youtube.* | unset %botflood* | unset %ysearch.* | unset %wa* | unset %url* | echo -atc info Unset $calc(%t - 2) variables }

Put this in the script and then type /clearvars into mIRC

ovelayer  -  Oct 15, 2015

anyway you could impliment it into the next update so it automatically does it? would be most appreciated

rebel9  -  Oct 26, 2015

set a timer for it, '//timer 0 1337 clearvars' in your irc bot, or add it in the script like that.

illhawkthat  -  Oct 26, 2015

Sorry for the late reply, been a little busy and a lot lazy. I do have this on my list and will work on an update to come within the next week.
Thanks for pointing this out!

illhawkthat  -  Nov 03, 2015

@rebel9 @ovelayer I think this is fixed in v6.2 - let me know if you still have issues. Thanks!

Sign in to comment

Hazem   -  Oct 12, 2015

Not working for me. On the 'Status window' says: "Server does not recognize NOOP command".
And when I type a YouTube link in a room, says: "* Invalid format: $ (line 234, youtube.ini)"

I downloaded and installed the latest version of SSL. So please help me. Thank you.

illhawkthat  -  Oct 13, 2015

@Hazem , did you upload this code into a new remotes file? (meaning no other code is in the file)? It sounds like something else may be interfering.

WildTiger  -  Oct 25, 2015

Hey Hazem it didn't work for me too i used bambino script which is PnPlus script just with more stuff but then i tried BsMaxScript and it works :-)

illhawkthat  -  Oct 26, 2015

@WildTiger can you help me out by explaining what wasn't working? Sorry for the trouble with the script!

Sign in to comment

John0877   -  Oct 08, 2015

What do I change to make it $notice me or echo to me and not publicly msg the channel?

illhawkthat  -  Oct 08, 2015

Hey @John0877 just to make sure I understand your question, are you talking about when you share a link to the channel, or when you do a search?

John0877  -  Oct 08, 2015

when the script outputs to the channel normally. I dont need the search so thats disabled. I just dont want it to msg the channel but rather echo to me or notice to me instead
Would be a cool option to add into the dialog in a future version possibly too.

John0877  -  Oct 12, 2015

Ive looked at the code and I can only see it msging the channel in case of error. I know Im missing something but Id like to change it to notice instead for the youtube link information.

illhawkthat  -  Oct 13, 2015

@John0877 the easiest/quickest way to do this is do ctrl+f to search for "msg $chan" and replace all occurrences with "notice $nick" I'll definitely look into adding this as an option in a dialog box in the future, but can you let me know if that works for now?

John0877  -  Oct 13, 2015

I replaced every instance of "msg $chan" with "notice $nick" and unloaded/loaded the script. It still somehow msgs the channel. O.o

illhawkthat  -  Oct 26, 2015

@John0877 Sorry for the late reply, been a little busy and a lot lazy. I do have this on my list and will work on an update to come within the next week.
Thanks for pointing this out!

illhawkthat  -  Oct 26, 2015

Oops comment posted twice and not sure how to delete

John0877  -  Nov 03, 2015

Ive been looking for a 6.2 for the last like 2 weeks :(

illhawkthat  -  Nov 03, 2015

@John0877 thanks for your patience and sorry for the delay! Can you update to v6.2 and enable the "Notice Only Mode" in options and let me know if that accomplishes what you were trying to do? Thanks!

John0877  -  Nov 08, 2015

I installed the 6.2 version and enabled the notice mode and it doesnt notice me when someone pastes a youtube url. I even went into the script and tried to find where it said notice $nick and changed to notice $me and it still isnt working.
I just want it to show to only me when someone pastes a youtube url not anyone else. Actualy I suspect it wouldnt be too difficult to add an echo mode as well, would it? For the notices mode, maybe a few sub-options of who to notice, yourself, the channel, or a particular user maybe. If that last part is too much work, I will understand. :) The echo part would be cooler I guess.

illhawkthat  -  Nov 14, 2015

@John0877 Try this: http://pastebin.com/YdNiK0Aa - I edited lines 206 and 303 to be echo instead of notice, see the changes here: (see the differences: http://pastebin.com/diff.php?i=YdNiK0Aa ) Let me know if this works!

John0877  -  Nov 15, 2015

That works great, thanks!

John0877  -  Nov 16, 2015

I was confused before but since youd changed it to the echo I can kinda see what to change to make it how I like it. with the echo -a it msged whichever channel was active which meant someone pasting a url in one channel would show the description in another. so i googled the echo command parameters and tweaked it slightly. I changed echo -a to echo 04 -t $chan $+ and now its perfect :D

Sign in to comment

WildTiger   -  Jun 23, 2015

hey i like this i've been looking for this one for a long time :D then a turkish friend shared this link , anyway how to change the color of the info i'm actually new to this , i mean can you please explain , thank you :)

illhawkthat  -  Jun 29, 2015

@WildTiger to disable color type /youtube and check "Disable formatting" under basic options. To change the color, search the script for ctrl + k to find instances of the color and change to the color you would like. Hint: you might want to search var %msg first to find where the youtube output is. Did that help?

WildTiger  -  Jul 13, 2015

oh thank you so much but can't you show by a video tutorial :/ i don't know how to do that i don't know this things i can't find what you said in there ,or tell me where can i put the color where is $ number or ? i'm sorry i don't know this codes and stuff..

illhawkthat  -  Jul 13, 2015

@WildTiger What color are you trying to change and what color would you like it to be?

WildTiger  -  Oct 25, 2015

i want the info to be Black bold and red

illhawkthat  -  Oct 26, 2015

Sorry for the late reply, been a little busy and a lot lazy. I do have this on my list and will work on an update to come within the next week.
Thanks for pointing this out!

illhawkthat  -  Nov 03, 2015

@WildTiger due to the number of colors, I'm not sure which ones you'd like to change. The colors are located on lines 424 through line 430. If you'd like to update them, replace "4" (currently red) and 10 (currently blue) with whichever colors you'd like. Use the index from this list, http://www.mirc.com/colors.html - let me know if you need help!

Sign in to comment

Wigoor   -  May 14, 2015

Seem to be some problem with new videos not parsing, ( https://www.youtube.com/watch?v=tUFxPUideHU could be becouse some number is 0 or null, like upvotes / downvotes? )

illhawkthat  -  May 16, 2015

Thanks for the report @Wigoor - are you still able to reproduce this error? Here is me trying it with a 0 view, 0 like, 0 dislike video uploaded 20 minutes ago and still works: http://i.imgur.com/7LkAiJd.png - Let me know if you still get the error with that URL above or a different URL and I can investigate more. Thanks!

Sign in to comment

dma   -  May 11, 2015

THANKS FOR THE UPDATE IM VERY HAPPY AGAIN :)

 Respond  
illhawkthat   -  May 10, 2015

@dma @commy @LobsterMan @IndyAdvant @Lianpobs @Wigoor released v5.9 to update to v3 of youtube API. Please update, sorry about the delay!
I know there are still some bugs in this version with durations, multiple search results, and a few other things i probably missed. Will review and post v6 to fix this! (Please let me know if you find other bugs I didn't mention) Thanks for your patience all!

illhawkthat  -  May 10, 2015

If you updated in past 3 minutes, please update again haha... fixed the duration bug. Thank you @SReject !

IndyAdvant  -  May 10, 2015

Thanks for the update! However doesn't seem to be spitting out any results.

illhawkthat  -  May 11, 2015

@IndyAdvant if that issue isn't fixed in version 6.0 please reply by comment here or in our chat - thanks!

Wigoor  -  May 11, 2015

You are using the "-e" switch for sockopen, dont think that one exist without other addons**?. got stuck on

"sockopen -e $+(youtube.,%ticks) www.googleapis.com 443"

After chaning that it went down to http://puu.sh/hJyPJ.png , managing to do sockopen but dosent go down to sockread.
mirc, 7.34


Tested in another client with 100% original code it seem it opens the connections, but it dosent do anything with them.

Open sockets:

youtube.23314982 www.googleapis.com:443 (216.58.209.138) tcp active
youtube.23362500 www.googleapis.com:443 (216.58.209.138) tcp active
mirc, 7.22

illhawkthat  -  May 11, 2015

@Wigoor thanks for your comment. What version of mIRC do you have? If you have earlier than v7.35 (check by doing //echo -a $version) you will need to either update your client or download an OpenSSL library for compatibility. Ref. http://www.mirc.com/ssl.html
Thanks so much for bringing my attention to this bug - can you let me know if updating your client or downloading OpenSSL fixes it for you? The new youtube API requires sockets to be over SSL.

Wigoor  -  May 11, 2015

That could be it, clients are 7.34 and 7.22, will check what happens with an update!

Wigoor  -  May 11, 2015

Yes, that worked for both clients, ( http://www.mirc.com/ssl.html -> OpenSSL 0.9.8zf -> restart mirc )
Thanks :)

illhawkthat  -  May 11, 2015

Thanks! Will update the instructions to reflect that.

Lianpobs  -  May 12, 2015

@illhawkthat thank you so much !

Sign in to comment

dma   -  May 10, 2015

can you please fix this script.. i run a channel from 40-65 people and they keep asking me when is it gonna be fixed ??? i said im waiting for the person
who made it , then it will be fixed .... so like 14 people really use it ,,, and I enjoy it as well - dma

commy  -  May 10, 2015

He said he would work on it ASAP, but he's busy with final exams. Not cool to be begging like this. I'm waiting for the update too, but if you need it so badly, update it yourself.

dma  -  May 10, 2015

thanks

Sign in to comment

LobsterMan   -  May 07, 2015

Yeah just chiming in that it appears youtube changed their API and stuff is broken

Would appreciate an update if you get a chance :)

dma  -  May 08, 2015

yesmplease

IndyAdvant  -  May 10, 2015

/agree ^_^

Sign in to comment

Lianpobs   -  May 06, 2015

Script is broken for me as of today
it will probably need a update to the v3 API with a request like this :
https://www.googleapis.com/youtube/v3/videos?part=snippet&id={VIDEO_ID}&key={API_KEY}

Lianpobs  -  May 06, 2015

Oh I hadn't read the earlier messages, I saw that you were already talking about v3 API on another specific bug

Wigoor  -  May 07, 2015

Yeah, the parse part of the script stopped working 2 days ago. That part is also blocked by youtubes api information.

illhawkthat  -  May 08, 2015

@Wigoor @Lianpobs @LobsterMan - thanks for your interest. Sorry about the delay in an update, I've been working through final exams here. Will have an update coming as soon as possible. Again, sorry for the delay!

IndyAdvant  -  May 10, 2015

Awesome!

Sign in to comment

Wigoor   -  Apr 21, 2015

Currently all video searches get blocked by this video since it is always on-top https://www.youtube.com/watch?v=UKY3scPIMd8
( http://gdata.youtube.com/feeds/api/videos?q=epic+sax+guy&v=2&prettyprint=true&max-results=2 )

All searches will output "No relevant results were found. Try different search terms." since there is no "<yt:rating" in that video.

https://youtube.com/devicesupport
"Certain older YouTube apps will no longer be supported after April 2015

Devices affected: Select devices manufactured in 2012 and earlier, including Sony TVs & Blu-ray Discs, Panasonic TVs & Blu-ray Discs, older iOS devices, and devices running older versions of Google TV.

As we upgrade the YouTube Data API(http://youtube-eng.blogspot.se/2014/03/committing-to-youtube-data-api-v3_4.html) to bring more features, we’ll begin shutting down the old version on April 20, 2015. This will result in the current YouTube app not working on certain device models from 2012 and older.

We will continue to focus our efforts on improving our official YouTube app for TV which is available on most 2013 and newer Smart TVs and Blu-ray players, game consoles and streaming devices. You can find a list of our device partners"

illhawkthat  -  Apr 21, 2015

@Wigoor, thanks for making me aware of this issue. I confirmed the problem with API v2 support and I am looking into migrating to version 3 now.

I'll do my best to get this working quickly and I will respond here when I have done so, but it may not be until later this weekend because I have a full week.

Thanks again for your comment!

illhawkthat  -  Apr 29, 2015

Thanks for finding that! I was going to use the same search page but it's annoying that the likes, dislikes, and some of the other details I need to do a separate request to the ID API.

Checking on this a little later. Sorry about the delay in an update - this just came at a bad time for me with exams and projects all due this week as well.

Sign in to comment

NyoHAWK   -  Apr 19, 2015

Fixed

dma  -  May 08, 2015

how did you fix it
.can you please tell me?

illhawkthat  -  May 08, 2015

@dma - thanks for your interest. Sorry about the delay in an update, I've been working through final exams here. Will have an update coming as soon as possible. Again, sorry for the delay!

Sign in to comment

ovelayer   -  Apr 05, 2015

awsome awsome script everyone including me absolutely luvs this script
i just wanted to let ya know i found a link type that does not work with your script
https://www.youtube.com/watch?v=3O0lyGgGQS0
just fyi
thanks for being an active part of this community! mirc is making a big comeback and luv to see ppl like you being active!

illhawkthat  -  Apr 05, 2015

Hi @ovelayer, glad you like the script!
I wasn't able to reproduce the error with that link (I just downloaded the song though haha)
Can you check to make sure the link isn't from a blacklisted channel or user (type /youtube and view nick & channel settings to check)
Also double check that it wasn't the last song parsed (type /unset %_youtube.last)
Thanks - Let me know if doing those things does not resolve this!

ovelayer  -  Apr 05, 2015

Ya neither of those were an issue channel is not blaclisted as i have the script only running in that channel.. and it wasnt last parsed..
hope this helps

illhawkthat  -  Apr 05, 2015

@ovelayer, what network and channel are you on and I can come debug?

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.