harl commented on a Page, Youtube url detector for mIRC  -  Mar 21, 2013

Hi, just dropping this here to let you know.
The latest version of March 17 doesn't work for me. For some reason, neither +ytdetect nor YouTube links seem to correctly activate the script (or its "on TEXT" part respectively), but there are no error messages whatsoever.
The older one I've been using still works just fine (though it only does so correctly with %LinkDetectorForYoutubeChanList set to # but not with single $network#$chan entries. I've tried either way as well with the newer version to no avail). The date on the working script's file says December 14 2012.

Stewie1k94  -  Mar 28, 2013

Try this... there is a slight error in lines 29, 30 and 31 with the variables.

On $*:Text:/(^[\+-])ytdetect$|(https?\x3a\/\/|www\.)(([\S]*youtube\.com[\S]+v\=)|(youtu\.be\/))([\S]{11})/Si:#: {
  var %tion $strip($regml(1)), %id $strip($regml(4))
  if (%tion isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
    if (%tion == +) {
      if ($istok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the LinkDetectorForYoutube script }
      else { 
        .enable #LinkDetectorForYoutube
        set %LinkDetectorForYoutubeChanList $addtok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)
        .msg $chan $nick has activated the LinkDetectorForYoutube script for $chan .
      }
    }
    else {
      if (!$istok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the LinkDetectorForYoutube script }
      else { 
        Set %LinkDetectorForYoutubeChanList $remtok(%LinkDetectorForYoutubeChanList,$+($network,$chan),1,32)
        .msg $chan $nick has deactivated the LinkDetectorForYoutube script for $chan . 
      }
    }
  }
  elseif (!$timer($+(LinkDetectorForYoutube,$network,$nick))) && ($istok(%LinkDetectorForYoutubeChanList,$+($network,$chan),32)) {
    .timer $+ $+(LinkDetectorForYoutube,$network,$nick) 1 4 noop
    GetLinkDetectorForYoutube .msg $chan %id
  }
}

It worked for me when I changed it. > [7:18pm] <~Stewie> +ytdetect
[7:18pm] <&thunderbolt> Stewie #i is already running the LinkDetectorForYoutube script

harl  -  Mar 28, 2013

Yea, I had tried that before, realizing that the variable wasn't supposed to look the way it does. The original variable's name is %action and somehow it became ¬tion in the script above - but correcting it doesn't change anything. This newer version of the script still doesn't work for me, when all I do is copy&paste it (and change the variable in those 3 lines).
Thanks for trying to help though!

Stewie1k94  -  Mar 30, 2013

When you view the 'Variables' page... is something like this in it > %LinkDetectorForYoutubeChanList Torn#i if not, maybe you could try adding the channels manually, just until you can get the +/-ytdetect to work. Also, you do have OP status or above in the channel, right? It won't work for the +/-ytdetect if you don't.

ircnoob74  -  Mar 30, 2013

Thanks, that fix worked. Do you by chance know how to make likes/dislikes work again? :)

Stewie1k94  -  Mar 30, 2013

Try this:

On *:sockread:LinkDetectorForYoutube*: {
  if ($sockerr) { sockclose $sockname | return }
  else {
    var %LinkDetectorForYoutube | sockread %LinkDetectorForYoutube
    if ($regex(%LinkDetectorForYoutube,/<span class="likes-count">(.*?)</span>/i)) { 
      hadd $sockname likes $+($hget($sockname,tagcolor),Likes:) $+($hget($sockname,textcolor),$regml(1)) 
    }
    elseif ($regex(%LinkDetectorForYoutube,/<span class="dislikes-count">(.*?)</span>/i)) { 
      hadd $sockname dislikes $+($hget($sockname,tagcolor),Disikes:) $+($hget($sockname,textcolor),$regml(1))
    }
    elseif (<span class="watch-view-count"> isin %LinkDetectorForYoutube) {
      hadd $sockname viewsFound 1
      if ($regex(%linkdetectorforyoutube,/\/user\/([^\/]+)\/videos/i)) {
        hadd $sockname uploader $+($hget($sockname,tagcolor),Uploader:) $+($hget($sockname,textcolor),$regml(1))
      }
    }
    elseif ($hget($sockname,viewsFound)) {
      hadd $sockname viewsFound 0
      hadd $sockname views $+($hget($sockname,tagcolor),Views:) $+($hget($sockname,textcolor),$remove(%LinkDetectorForYoutube,<strong>,</strong>)) 
    }
    elseif (($regex(%LinkDetectorForYoutube,/dir="ltr">(.*?)<\/a><span class="yt-user-separator">/i))) {
      hadd $sockname uploader $+($hget($sockname,tagcolor),Uploader:) $+($hget($sockname,textcolor),$regml(1))
      hadd $sockname date $+($hget($sockname,tagcolor),Upload Date:) $+($hget($sockname,textcolor),$regml(2))
    }
    elseif (($regex(%LinkDetectorForYoutube,/watch-video-date"\s>(.*?)<\/span>/i))) {
      hadd $sockname date $+($hget($sockname,tagcolor),Upload Date:) $+($hget($sockname,textcolor),$regml(1))
      if ($hget($sockname,tags)) $gettok($sock($sockname).mark,1-2,32) $hget($sockname,logo) $Xchr($regsubex($v1,/([\S]+)/g,$hget($sockname,\t)))
      if ($hget($sockname)) hfree $sockname
      sockclose $sockname          
    }    
    elseif ($regex(%LinkDetectorForYoutube,/class="watch-video-date"\s>(.*?)<\/span>/)) {
      hadd $sockname date $+($hget($sockname,tagcolor),Upload Date:) $+($hget($sockname,textcolor),$regml(1))
    }
    elseif ($regex(%LinkDetectorForYoutube,/class="long-title".*title="(.*?)">/)) {
      hadd $sockname title $+($hget($sockname,tagcolor),Title:) $+($hget($sockname,textcolor),$regml(1))
    }
    elseif ($regex(%LinkDetectorForYoutube,/<meta\sname="title"\scontent="(.*?)">/)) {
      hadd $sockname title $+($hget($sockname,tagcolor),Title:) $+($hget($sockname,textcolor),$regml(1))
    }
  }
}

[6:45pm] <~Stewie> http://www.youtube.com/watch?v=kHeMck0Ap3I
[6:46pm] <&thunderbolt> YouTube Title: Amaranthe -Razorblade Views: 1,583 Likes: 19 Disikes: 1 Uploader: Luis Manuel Oviedo Vizcaya Upload Date: 23 Mar 2013

ircnoob74  -  Mar 31, 2013

awesome. I tried to figure it out myself and had something similar, but it didn't work. You're the man, thanks.

Stewie1k94  -  Mar 31, 2013

You're welcome mate. :)

harl  -  Apr 06, 2013

Yes, I know about %LinkDetectorForYoutubeChanList.

TL/DR: I'm out of ideas - but I'll just use the working version of the script that I have.

Stewie1k94  -  Apr 07, 2013

So... this version of the script is not working at all for you? :(

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.