This script will generate a Download link for a valid Youtube video url.
This script is made to be loaded into your bot and triggered by a second client but it can also be loaded into your main client and used with an alias.
Alias:
/YTDL ValidYoutubeVideoLinkHere
Will echo the results to the active screen.
Bot Triggers:
!YTDL ValidYoutubeVideoLinkHere
Will notice the user the results.
@YTDL ValidYoutubeVideoLinkHere
Will message the channel if the user has half ops or higher. Otherwise it will notice the user.
To use the bot triggers, right click the channel or status, select Youtube Download Link Trigger and click ON
Example Output:
21:40:00 @ytdl http://www.youtube.com/watch?v=RMnH5nhUUZI&feature=channel
21:40:01 <+Lunch|Box Searching Youtube........
21:40:02 <+Lunch|Box Low Download http://tinyurl.com/ykqvb9v
21:40:02 <+Lunch|Box High Download http://tinyurl.com/yghfrz3
;Youtube download link generator by Ford_Lawnmower irc.mindforge.org #USA-Chat
menu Channel,Status {
.$iif($group(#YTDL) == On,$style(1)) Youtube Download Link Trigger
..$iif($group(#YTDL) == On,$style(2)) On: .enable #YTDL
..$iif($group(#YTDL) == Off,$style(2)) Off: .disable #YTDL
}
#YTDL OFF
On $*:Text:/^(!|@)YTDL.*/Si:#: {
if (!$timer($+(YTDL,$network,$nick))) {
.timer $+ $+(YTDL,$network,$nick) 1 6 noop
var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
YTGetLink %method $2-
}
}
#YTDL END
alias YTDL { YTGetLink echo -a $1- }
alias -l YTGetLink {
if (!$3) { $1-2 Syntax youtube linktovideohere }
elseif (!$regex($3,/.*youtube\.com\/watch\?v=[\S]{11}/Si)) { $1-2 Invalid Link! Recheck it and try again! }
else {
$1-2 Searching Youtube........
var %sockname $+(YTDL,$network,$2,$ticks)
sockopen %sockname www.youtube.com 80
sockmark %sockname $1-2 $left($gettok($3,2,61),11)
}
}
On *:sockopen:YTDL*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $+(/watch?v=,$gettok($sock($sockname).mark,3,32)) HTTP/1.1
sockwrite -n $sockname Host: www.youtube.com
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
on *:sockread:YTDL*: {
sockread %ytube
if ($regex(%ytube,"t":\s"(.*)"\x2C\s"(?:instream|fexp|rv\.6\.id)":)) {
var %key $left($regml(1),46)
ShrinkYT $gettok($sock($sockname).mark,1-2,32) 05High Download $+(http://www.youtube.com/get_video?,video_id=,$gettok($sock($sockname).mark,3,32),&t=,%key,&fmt=18)
ShrinkYT $gettok($sock($sockname).mark,1-2,32) 11Low Download $+(http://www.youtube.com/get_video?,video_id=,$gettok($sock($sockname).mark,3,32),&t=,%key)
sockclose $sockname
}
}
alias -l ShrinkYT {
if ($regex($1,/^[\.]?(echo|msg|notice)/Si)) && ($3) {
if ($wildtok($strip($3-),http://*.*,0,32) == $wildtok($strip($3-),*http://tinyurl.com*,0,32)) {
$1-
return
}
var %count $wildtok($strip($3-),http://*.*,0,32), %text $strip($3-)
while %count {
if ($left($wildtok(%text,http://*.*,%count,32),18) != http://tinyurl.com) {
tinyyt $1-2 $wildtok(%text,http://*.*,%count,32) $3-
%count = 0
return
}
dec %count
}
}
else { echo -st ShrinkLinks error -- must start with msg #chan - msg nickname - notice nickname or echo -a }
}
alias -l TinyYT {
var %sockname $+(YTTiny,$network,$ticks,$r(1,$ticks))
sockopen %sockname tinyurl.com 80
sockmark %sockname $1-2 $+(/create.php?url=,$3) $3 $4-
}
On *:sockopen:YTTiny*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
sockwrite -n $sockname Host: tinyurl.com
sockwrite -n $sockname $crlf
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:YTTiny*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %Tiny | sockread %Tiny
if ($regex(%Tiny,/<blockquote><b>(.*)<\/b><br><small>/i)) {
tokenize 32 $sock($sockname).mark
ShrinkYT $1-2 $replace($5-,$4,$regml(1))
sockclose $sockname
return
}
}
}
@RIcko For now you can use this script if you want something simple to download youtube videos:
http://www.hawkee.com/snippet/9281/
@GuitarMasterx7 I'll consider adding the Name and File size when I get some time.
If you want more information added, this one even has a picture -->> http://code.google.com/p/fordlawnmower/wiki/YoutubeVideoDownloader
ohh thas awesome.
=o
if you add anything you can put the uhhh
youtube direct link to the video to watch before dling wif the
length/views/votes/user who posted/how longs its been there[bit pointless an prob spams like crazy]
besides the suggestion
dat
is
awesome =D lol
alias -l ShrinkYT
das a cute alias name lolz