/youtube - YouTube Video Download Alias

By Kirby on Jun 03, 2009

Just a small alias for downloading YouTube videos, whipped in about half an hour.

[size=20]Syntax: /youtube [/size]

An example of a "full url" would be something like this:

/youtube http://www.youtube.com/watch?v=Xw6kAAkKFak

Although http://www.mediaconverter.org/ is far more efficient in terms of selecting preferable file extensions, I thought it'd be neat to show that it can be done using basic mIRC coding.

Once the command is activated and the compressed url is retrieved, mIRC will automatically open up the direct link in your default Internet browser.

The downloaded file will always be in Flash Video format, otherwise known as .flv, in the file name of video.flv. Unless you have a resource that enables playing of .flv files, this won't be the best for you. Many programs such as iTunes, WinAmp, and video editing programs are available for viewing the downloaded videos.

As a small addition, I've added a url compressor - TinyUrl! TinyUrl compresses the very long file name for the direct link to the video, mainly in the sense of creating ease for the eyes.

Here's a picture:
Image

alias youtube {
  if (!$1) echo -a * Syntax: /youtube <full url>
  elseif (!$regex($1,http:\/\/.*youtube.*\/watch\?v=.{11}&?.*)) echo -a * Url specified was not valid. Please check that you have entered the full YouTube Url.
  else {
    sockopen yt www.youtube.com 80
    sockmark yt $1
  }
}
on *:sockopen:yt:{
  noop $regex($sock(yt).mark,http:\/\/(.*youtube.*)(\/watch\?v=.{11})&?.*)
  sockwrite -n $sockname GET $regml(2) HTTP/1.1
  sockwrite -n $sockname Host: $regml(1)
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:yt: {
  sockread %yt
  if ($regex(%yt,.+'(/watch_fullscreen)(.+)';)) {
    var %x $regsubex($regsubex(%yt,.+'(/watch_fullscreen)(.+)',/get_video\2),/(\s)/g,+)
    noop $regex($sock(yt).mark,(http:\/\/)(.*youtube.*)(\/watch\?v=.{11})&?.*)
    sockopen tu tinyurl.com 80
    sockmark tu $+($regml(1),$regml(2),%x)
  }
}
on *:sockopen:tu: {
  sockwrite -n $sockname GET $+(/create.php?url=,$sock(tu).mark) HTTP/1.1
  sockwrite -n $sockname Host: tinyurl.com
  sockwrite -n $sockname $crlf
}
on *:sockread:tu: {
  sockread %yt
  if ($regex(%yt,<blockquote><b>(http:\/\/(?!preview\.).+)</b>)) {
    echo -a [1,0You0,4Tube]: Downloading the video... $+(,$regml(1),)
    url -an $regml(1)
    unset %yt
  }
}

Comments

Sign in to comment.
Exploiter   -  Jul 17, 2010

Not working for me =S

 Respond  
Jonesy44   -  Jun 17, 2010

That's hawkee stripping the color codes on the website.

 Respond  
cptpan   -  Jun 17, 2010

My response has 2 squares in front of it?

YouTube: [SQUARE SQUARE] OK Go on the Road - Tim and Dan Reenact Scene from Casino

They appear to paste here as giant spaces, I don't know why it's happening?

 Respond  
WorldDMT   -  Jun 07, 2009

ok as u like :)

 Respond  
slacker   -  Jun 06, 2009

@WorldDMT i never said i didnt like ur comments i said you are annoying as hell.

 Respond  
Jonesy44   -  Jun 06, 2009

Are you french?

 Respond  
WorldDMT   -  Jun 06, 2009

@slacker:
if u dont like my comments they r others like it
go and comment my codes if you want.
who doesnt accept comments
not posting...

 Respond  
Jethro   -  Jun 06, 2009

Is it me or what? I can smell some negative tension at this commenting forum. Let's turn it into positive momentum, shall we? By the way, nice work, Kirby. :>

 Respond  
buddy   -  Jun 05, 2009

not work when i try it....when i type /youtube 'fullurl' i just wait and after 5 minutes later nothing happen....

 Respond  
slacker   -  Jun 05, 2009

WorldDMT why dont you worrie about ur own scripts an STFU for awhile.. You tend to get annoying as hell sorry to say.

 Respond  
WorldDMT   -  Jun 05, 2009

no prob if u want u can try

Here are a valid YouTube link, but your regex detects an error

http://www.youtube.com/watch?gl=FR&hl=fr&v=BZmE3fUKU5U

your regex can be check all that valide links?? no!!

but look Here are 3 invalid YouTube links but your regex does not detect any error

1- http://www.youtube.com/watch?v=RFMT_IzT4&feature=rec-HM-fresh+div

RFMT_IzT4 <==== 9 characters not 11 !!!

2- http://ww.youtube.com/watch?v=Pc3yFlYlhCQ&feature=fvw

ww. <====== not www. !!

3- http://wwwxyoutubexcom/watch?v=Pc3yFlYlhCQ&feature=fvw

no dots!!!

so finally, my own opinion is

$regex($1,http:\/\/www\.youtube\..+\/watch\?(gl=..&..=..&v|v)=[^&]{11})

this regex will check if the link is

http://www.youtube.<something(.com .fr) mabe>/watch?= over 11 characters not include "&"

u can try that regex with all that links and that checking better

 Respond  
Kirby   -  Jun 05, 2009

No, there's no problem with the regex...

$regex($1,http:\/\/www.youtube.*\/watch\?v=[^&]{11}

That would be having an & tag directly after /watch?v=, which would not be a valid video ID.

 Respond  
WorldDMT   -  Jun 05, 2009

i think u have a prob with your regex

must be like this

$regex($1,http:\/\/www.youtube.*\/watch\?v=[^&]{11})
 Respond  
WorldDMT   -  Jun 05, 2009

ok for the link checker but all before u can replace if u want i don't say that's wrong :)

 Respond  
blitzz   -  Jun 04, 2009

i like this 1 Kirby but a little bit slow when loading/open.. my RAM is 3.2G n connections speed 512mbps..but nice code..like it..8/10

 Respond  
Prelude   -  Jun 04, 2009

kirby...you're sucha nerd, well done dear boy. 8/10. Now make something id use;p

 Respond  
Kirby   -  Jun 04, 2009

No, you [size=28]don't[/size] want to use:

elseif (!$wildtok($1,http://www.youtube.com/watch?v=*,1,32)) echo -a * Url specified was not valid. ...

because with the regex I put in, it does four things: Check to see if it's an actual YouTube URL, varies the different "types" of YouTube (as in countries), checks to see if the video ID matches 11 characters, and strips out any other & tags.

 Respond  
Aucun50   -  Jun 04, 2009

I don't think he needs to "stfu" as he was just putting his opinion. There's nothing wrong with making a point about someone's scripting, after all he said "i think no need for regex here" not "you over use $regex and there's no need for it here".

 Respond  
Prelude   -  Jun 04, 2009

worldDMT: stfu

 Respond  
Aucun50   -  Jun 04, 2009

That looks neat.

 Respond  
Jonesy44   -  Jun 04, 2009

It's an either or situation.. you can use both ;D

 Respond  
WorldDMT   -  Jun 04, 2009

hi

good job Kirby but i think no need for regex here

elseif (!$wildtok($1,http://www.youtube.com/watch?v=*,1,32)) echo -a * Url specified was not valid. ... 
on *:sockopen:yt:{
  tokenize 47 $sock(yt).mark
  sockwrite -n $sockname GET / $+ $3 HTTP/1.1
  sockwrite -n $sockname Host: $2
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}

like that

 Respond  
Kirby   -  Jun 04, 2009

no problem..

 Respond  
aitor1976   -  Jun 04, 2009

thank you..

 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.