YouTube Script 2.0

By N3M3S1S on Sep 24, 2010

Intended for a channel bot.

Just copy and paste into remotes.

mIRC 6.35+

Gives information on youtube links when posted in the channel, and can now also do YOUTBUE SEARCHES!

Triggered when YouTube link is posted in chat....

YouTube Link Info:

[15:42] <@Neo-Nemesis> http://www.youtube.com/watch?v=rwY3Ftfdy6M
[15:42] <@Boris_III> YouTube Title: Iron Maiden - Killers
[15:42] <@Boris_III> YouTube Info: Iron Maiden - Killers Members: Paul Di'Anno - vocals Steve Harris - bass guitar Dave Murray - guitar Adrian Smith - guitar Clive Burr - drums Iron Maiden's o...

Triggered when user types !youtube

YouTube Search:

[15:43] <@Neo-Nemesis> !youtube Iron Maiden
[15:43] <@Boris_III> YouTube Search - About 105,000 results - http://www.youtube.com/results?search_query=Iron+Maiden&aq=f
[15:43] <@Boris_III> YouTube Official YouTube Channel Link http://www.youtube.com/user/ironmaiden?blend=1
[15:43] <@Boris_III> YouTube Iron Maiden Wasted Years Link: http://www.youtube.com/watch?v=SwB9zg7Tbx8
[15:43] <@Boris_III> YouTube Iron Maiden, ACDC and Guns N Roses 4 LIFE Link http://www.youtube.com/user/benoitiginla12?blend=3
[15:43] <@Boris_III> YouTube aces high Link: http://www.youtube.com/watch?v=4Sam5omG0v0

;YouTube Info 2.0
;By Neo Nemesis
on *:TEXT:*youtube*:#: {
  if ($1 == !youtube) { 
    %c.ytb = $chan
    YouTube search $2-
  }
  else {
    %c.ytb = $chan
    YouTube $1
  }
}
alias s.YTB.Parse {
  if (&amp; isin $remove($gettok($1-,2,32),href=",$chr(34))) { return $replace($remove($gettok($remove($1-,<h3>,<b>,</b>,</h3>),2,62),</a),&quot;,$chr(34),&#39;,$chr(39),&amp;,$chr(38)) 4Link15 http://www.youtube.com $+ $gettok($remove($gettok($1-,2,32),href=",$chr(34)),1,38) }
  else { return $replace($remove($gettok($remove($1-,<h3>,<b>,</b>,</h3>),2,62),</a),&quot;,$chr(34),&#39;,$chr(39),&amp;,$chr(38)) 4Link:15 http://www.youtube.com $+ $remove($gettok($1-,2,32),href=",$chr(34)) }
}
alias YouTube {
  if ($1 == search) {
    ;search
    unset %ysrc*
    sockclose s.ytb
    %ysrch = /results?search_query= $+ $replace($2-,$chr(32),$chr(43)) $+ &aq=f
    sockopen s.ytb www.youtube.com 80
  }
  else {
    unset %ytb*
    sockclose ytb
    %ytb1 = $remove($1,http://,www.,youtube,.com)
    sockopen ytb www.youtube.com 80
  }
}
on *:SOCKOPEN:s.ytb: {
  sockwrite -n $sockname GET %ysrch HTTP/1.1
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf
}
on *:SOCKREAD:s.ytb: {
  sockread %ysrc.1
  if (About <strong> isin %ysrc.1) { 
    .timerYTB6 1 1 msg %c.ytb 1,0You0,4Tube15,1 Search - $remove(%ysrc.1,<strong>,</strong>) - http://www.youtube.com $+ %ysrch
    %ysrc.3 = $true
  }
  if (dir="ltr" title=" isin %ysrc.1) && (%ysrc.3 == $true) {
    if (%ysrc.2) { inc %ysrc.2 }
    else { %ysrc.2 = 1 }
    if (%ysrc.2 <= 4) { .timerYTBb $+ %ysrc.2 1 $calc(%ysrc.2 + $rand(1,2)) msg %c.ytb 1,0You0,4Tube15,1 $s.YTB.Parse(%ysrc.1) }
    else { sockclose s.ytb } 
  }
}
on *:SOCKOPEN:ytb: {
  sockwrite -n $sockname GET %ytb1 HTTP/1.1
  sockwrite -n $sockname Host: www.youtube.com
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname Content-Type: text/html
  sockwrite -n $sockname $crlf 
}
on *:SOCKREAD:ytb: {
  sockread %ytb2
  if (<meta name=" isin %ytb2) {
    if (="title" content=" isin %ytb2) { 
      %ytb.title = $remove(%ytb2,<meta name="title" content=",">) 
      .timerYTB1 1 1 msg %c.ytb 1,0You0,4Tube15,1 Title: $replace(%ytb.title,&#39;,$chr(39),&quot;,$chr(34),&amp;,$chr(38)) $+ 
    }
    if (="description" content=" isin %ytb2) { 
      %ytb.desc = $remove(%ytb2,<meta name="description" content=",">)
      .timerYTB2 1 2 msg %c.ytb 1,0You0,4Tube15,1 Info: $replace(%ytb.desc,&#39;,$chr(39),&quot;,$chr(34),&amp;,$chr(38)) $+ 
    }
    if (%ytb.title) && (%ytb.desc) { sockclose ytb }
  }
}

Comments

Sign in to comment.
N3M3S1S   -  Oct 14, 2012

@alimak96: If you don't think its useful then don't use the script and save comment space for those who do use it :P This script is intended for a IRC channel bot anyways.

@Everyone Else:

Sorry haven't been around lately, enjoying my year long coder vacation!

When vacation is over I will begin working on YouTube Script and the IRC Guard 5000 and releasing new versions of them at the beginning of my next coding year, which should be pretty soon, I've been itching to get back to coding, just taking a break to let the carpal tunnel wear off more.

Soon my lovlies soon.

 Respond  
wazer   -  Sep 06, 2012

Can we get an updated version?

 Respond  
Stewie1k94   -  Sep 06, 2012

Some people like to do it from mIRC... It's easier for some people!

 Respond  
alimak96   -  Sep 05, 2012

its useless , just go to youtube and search in the search box its not hard -_-

 Respond  
ShadowMan   -  Sep 04, 2012

To handle youtu.be type url's, you can do a simple replace
$replace($1-,youtu.be/,youtube.com/watch?v=)
I suppose you can do the same for https as well

 Respond  
N3M3S1S   -  Jul 31, 2012

Mod at your own risk, and mod as necessary. The https and youtu.be links probably won't work since this script was made before youtube started using those.

 Respond  
Kilim   -  Jul 13, 2012

After using this for a while, people started posting https links and it wouldn't read it. Any little mod I can add to make it work?

 Respond  
N3M3S1S   -  Oct 02, 2011

o.O

 Respond  
Stewie1k94   -  Sep 29, 2011

lmao Jethro

 Respond  
Jethro   -  Sep 29, 2011

CrazyShady, that's a crazy thing to say. Hawkee is the nickname for the site admin. The word "rape" sounds pretty gay.

 Respond  
CrazyShady   -  Sep 28, 2011

I don't rape Hawkee lol so I probably won't know.

 Respond  
N3M3S1S   -  Sep 28, 2011

I will post it here when I do.

 Respond  
CrazyShady   -  Sep 27, 2011

Let me know when you do.

 Respond  
N3M3S1S   -  Sep 25, 2011

Thank you. On mine its been having a few issues with certain search info, i think its because youtube has updated since i wrote this, but I plan on making a better version eventually :P

 Respond  
CrazyShady   -  Sep 05, 2011

Very nice N3M3S1S. I like the search part of this script. It comes in very handy sometimes. Very nice work.

 Respond  
Stewie1k94   -  Jul 20, 2011

Just wondering if i could get it to tell me who it was uploaded by when i post a youtube link

 Respond  
N3M3S1S   -  Jul 05, 2011

Okay noted, I will look into that as well.

 Respond  
Sonic7   -  Jul 03, 2011

cool :D


I notice that if you time something like (for example): testhttp://www.youtube.com/watch?v=rdTVb64pfMs&hd=1test the script does not detect the link also sometimes if it is: "example http://www.youtube.com/watch?v=rdTVb64pfMs&hd=1 example" it does not work

 Respond  
N3M3S1S   -  Jul 02, 2011

Yes, I can look into it. I am busy with WORK WORK WORK lol, but I am formulating a new version of this script :D

 Respond  
Sonic7   -  Jun 30, 2011

Hello can you add the ability to report youtube views?

 Respond  
H0LLYWOOD   -  Jun 22, 2011

would it be possible to make it at least display some of this information?
[YouTube] Title: Vince Carter Top 10 In Your Face Dunks | Uploaded: 10/05/07 by yelistener | Length: 2:50 | Views: 712,361

or would anyone know where i could locate a working YouTube detector script. thanks
looks good tho N3M3S1S, glad to know ppl are still trying on this topic

 Respond  
N3M3S1S   -  Jun 22, 2011

Been busy, sorry I have a lot to deal with right now IRL, all I do is work work work! Don't worry I have been working on a new version.

 Respond  
Stewie1k94   -  Jun 17, 2011

i dont seem to be getting any response to this script anymore any reason why?

 Respond  
Stewie1k94   -  Jun 15, 2011

[10:54am] <04~toclafane> http://www.youtube.com/watch?v=RSXHKrPVopg&feature=youtu.be
[10:54am] <03&thunderbolt> 4toclafane 10is currently watching4 Geese on I-90

 Respond  
N3M3S1S   -  Jun 15, 2011

Manually altering the code would remove that.

Hmm that is strange, it must not be returning the correct information.

YouTube recently added YouTu.be to their servers so now instead of just YouTube.com it also have YouTu.be so any links that have YouTu.be instead of YouTube.com may cause problems.

I will make a new version soon.

 Respond  
KilllerX   -  Jun 07, 2011

Kinda Broken for me...

when I do a !Youtube (whatever)

It gives me the first link to the search that youtube would give... but the Video Links aren't working...

It goes

Killlerx: !youtube test
Killlerx: YouTubeSearch - About 1,940,000 results - http://www.youtube.com/results?search_query=test&aq=f
Killlerx: YouTube

Killlerx: YouTube

Killlerx: YouTube MOTORVISION TEST 4Link15 http://www.youtube.com/user/motorvisiontest?blend=3

Killlerx: YouTube

Note it appears fine on mIRC but the server it is connected to the IRC they are using (with the video cast) it isn't working. Is there a way to take out the top 4 video's appearing?

 Respond  
Stewie1k94   -  Jun 05, 2011

@kaoporrex i think ur english is fine

 Respond  
N3M3S1S   -  Jun 04, 2011

Don't know about 7.19, made this with 6.35, I will have to update and see...

 Respond  
kaoporrex   -  Jun 02, 2011

Ehmm dunno but with mirc 7.19 , charging the code at youtube.mrc .... !youtube Iron maiden ...and doesnt work. Idea?

This url doesnt work http://www.youtube.com/watch?v=_XI1DD_vJuY

¿¿?? Sorry for my poor english

 Respond  
N3M3S1S   -  May 29, 2011

Thank you Jethro_ for helping with that. I have been very busy lately (with work and now running a ebay store!) so I have little time for anything but WORK :(

 Respond  
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.