The Following 2 Users Say Thank You to gogol For This Useful Post: | ||
![]() |
2007-08-13
, 09:16
|
|
Posts: 1,463 |
Thanked: 81 times |
Joined on Oct 2005
@ UK
|
#2
|
![]() |
2007-08-13
, 17:19
|
|
Posts: 177 |
Thanked: 57 times |
Joined on Aug 2007
@ Washington State, USA
|
#3
|
![]() |
2007-08-14
, 19:50
|
|
Posts: 177 |
Thanked: 57 times |
Joined on Aug 2007
@ Washington State, USA
|
#4
|
#!/usr/bin/perl # Filename: myfilm # Author: David Ljung Madison <DaveSource.com> # See License: http://MarginalHacks.com/License/ # Description: Download iFilm/youtube movies given a film ID. # Converts youtube films from flash to .mov if ffmpeg is available. my $VERSION= '1.02'; use strict; ################################################## # Setup the variables ################################################## my $PROGNAME = $0; $PROGNAME =~ s|.*/||; my ($BASENAME,$PROGNAME) = ($0 =~ m|(.*)/(.+)|) ? ($1?$1:'/',$2) : ('.',$0); # This will probably change.. my $IFILM = "http://www.ifilm.com/player/mac.jsp?ifilmId="; my $YOUTUBE = "http://youtube.com/get_video.php?l=165&video_id="; # How to fetch web files - pick one # Actual Safari agent example: # Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13 my $GET = "GET -H 'user-agent: Mozilla/5.0'"; my $LYNX = "links -source"; my $GET_URL = $LYNX; my $POST = "mov"; # For converting youtube to .mov my $FFMPEG = "ffmpeg"; ################################################## # Usage ################################################## sub fatal { foreach my $msg (@_) { print STDERR "[$PROGNAME] ERROR: $msg\n"; } exit(-1); } sub usage { foreach my $msg (@_) { print STDERR "ERROR: $msg\n"; } print STDERR <<USAGE; Usage:\t$PROGNAME [-d] <ifilm URL, youtube URL or ifilm id> Download an ifilm movie -o <file> Save to file -bw <56,200,300> Force a bandwidth other than your iFilm settings -d Set debug mode -bg Run ffmpeg in the background USAGE exit -1; } sub parse_args { my $opt = {}; while (my $arg=shift(@ARGV)) { if ($arg =~ /^-h$/) { usage(); } if ($arg =~ /^-d$/) { $MAIN::DEBUG=1; next; } if ($arg =~ /^-bg$/) { $opt->{bg} = 1; next; } if ($arg =~ /^-bw$/) { $opt->{bw} = shift @ARGV; next; } if ($arg =~ /^-o$/) { $opt->{save} = shift @ARGV; next; } if ($arg =~ /^-/) { usage("Unknown option: $arg"); } if ($arg =~ m|^http://([^/]+)/.*?([^/]+)$|) { ($opt->{url}, $opt->{dom}, $opt->{film}) = ($arg, $1, $2); next; } if ($arg =~ /^[0-9]+$/) { ($opt->{arg}, $opt->{dom},$opt->{film}) = ("ifilm.com", $arg); next; } usage("Unknown film id. I need an iFilm or youtube URL"); } usage("No film URL specified.") unless $opt->{film}; $opt; } sub debug { return unless $MAIN::DEBUG; foreach my $msg (@_) { print STDERR "[$PROGNAME] $msg\n"; } } ################################################## # Utils ################################################## sub title_embed { my ($opt, $url) = @_; debug("URL: $url"); my $open = "$GET_URL $url"; debug("GET: $open"); open(FILM,"$open |") || usage("Couldn't get URL: $url\nMake sure [$GET_URL] is installed"); # Find the film location my $dl; my $title; my $bw = $opt->{bw}; my $embed; my $and_t; while(<FILM>) { $dl = $1 if /var\s+dl\s*=\s*"?(-?\d+)"?/; $bw = $1 if !$bw && /var\s+bw\s*=\s*"?(\d+)"?/; $embed = $1 if /<embed.*(http:[^>"]+)/i; $title = $1 if /span class="title">([^<]+)/; $title = $1 if /<title>(.*)<\/title>/; $and_t = $1 if /video_id=.*&t=([^&"]+)/; } close(FILM); ($title,$embed,$dl,$bw,$and_t); } ################################################## # iFilm ################################################## sub iFilm { my ($opt,$film) = @_; print STDERR "Fetching iFilm ID: $film\n"; # Read the ifilm HTML my $url = $IFILM.$film; my ($title,$smil,$dl,$bw) = title_embed($opt, $url); $title = $title || $film; usage("Couldn't find 'dl' key in URL [$url]") unless $dl; usage("Couldn't find 'bw' key in URL [$url]") unless $bw; usage("Couldn't find 'embed' tag in URL [$url]") unless $smil; $smil =~ s/'\s+\+\s+dl\s+\+\s+'/$dl/g; $smil =~ s/'\s+\+\s+bw\s+\+\s+'/$bw/g; $smil =~ s/"$//; debug("SMIL: $smil"); # Get the smil file my $open = "$GET_URL \Q$smil\E"; open(SMIL,"$open |") || usage("Couldn't get SMIL: $smil"); my $video; while (<SMIL>) { $video = $1 if /video src="(http[^"]+)"/; } usage("Couldn't find video source key in SMIL [$smil]") unless $video; close SMIL; debug("Found: $video"); $title =~ s/[:\s]+/_/g; my $save = $opt->{save} || "$title.$POST"; $save =~ s|/|_of_|g; print "Saving to: $save\n"; debug("$GET_URL \Q$video\E > \Q$save\E\n"); system("$GET_URL \Q$video\E > \Q$save\E"); } ################################################## # youtube ################################################## sub youtube { my ($opt, $film) = @_; print STDERR "Fetching youtube ID: $film\n"; # Get name my ($save,undef,undef,undef,$and_t) = title_embed($opt, $opt->{url}); fatal("No '&t=' code found for youtube [$opt->{url}]") unless $and_t; if ($opt->{save}) { $save = $opt->{save}; } else { fatal("No title found for youtube [$opt->{url}]") unless $save; $save =~ s/youtube( - )?(.+)/$2/ig; print STDERR "Found film '$save'\n"; $save =~ s/[:\s]+/_/g; } $save =~ s/(\.flv)?$/.flv/; $save =~ s|/|_of_|g; $save =~ s/[\*\?\'\"]//g; # Get rid of troublesome characters. # ffmpeg gets confused easily # Get video #print "TITLE; $title -> $save\n"; my $video = $YOUTUBE.$film."&t=$and_t"; debug("Video: $video"); print "Saving to: $save\n"; system("$GET_URL \Q$video\E > \Q$save\E"); # Attempt convert to .mov my $mov = $save; $mov =~ s/\.flv$/.mov/; print "Convert to: $mov\n"; exec($FFMPEG,"-v",0,"-i",$save,$mov) unless fork; if ($opt->{bg}) { sleep 1; # To let the intial ffmpeg output go through.. } else { wait; } } ################################################## # Main code ################################################## sub main { my $opt = parse_args(); if ($opt->{dom} =~ /youtube/i) { $opt->{film} = "watch?v=$opt->{film}" if $opt->{url} =~ s|www.youtube.com/v/|www.youtube.com/watch?v=|; usage("Couldn't find youtube video (URL must contain 'v=[video_id]')") unless $opt->{film} =~ /v=([a-z0-9_-]+)/i; return youtube($opt, $1); } if ($opt->{dom} =~ /ifilm/i) { usage("Couldn't find iFilm video (URL must contain a number/film id)") unless $opt->{film} =~ /([0-9]+)/; return iFilm($opt, $1); } } main();
![]() |
2007-08-14
, 20:18
|
Posts: 17 |
Thanked: 0 times |
Joined on Aug 2007
|
#5
|
...although it's still not very streamlined...what I'd like is to get this clever javascript bookmark to work in the browser. Why doesn't that script work even with javascript enabled in the preferences?
![]() |
2007-08-14
, 20:42
|
|
Posts: 177 |
Thanked: 57 times |
Joined on Aug 2007
@ Washington State, USA
|
#6
|
![]() |
2007-08-17
, 02:49
|
|
Posts: 177 |
Thanked: 57 times |
Joined on Aug 2007
@ Washington State, USA
|
#7
|
#!/usr/bin/perl # Filename: myfilm # Author: David Ljung Madison <DaveSource.com> # See License: http://MarginalHacks.com/License/ # Description: Download iFilm/youtube movies given a film ID. # Converts youtube films from flash to .mov if ffmpeg is available. my $VERSION= '1.02'; # # Requires that ifilm/youtube's obfuscation doesn't change drastically. # # youtube: http://youtube.com/watch?v=[video_id] # video at: http://youtube.com/get_video.php?l=165&video_id=[video_id]&t=[??] # Need to find &t=[c0de] in HTML # # ifilm: http://www.ifilm.com/ifilmdetail/2667392 # -> http://secure.ifilm.com/qt/portal/2667392_300.mov?e=1159050000&h=6c97297693c58d818e86aba0819abf10 # Update: Don't know how to look this up with iFilm's new Flash player # # Also see: http://javimoya.com/blog/youtube_en.php ################################################## # CHANGELOG ################################################## # 2007/8/16 # ---------------- # Haxxed for the 770 by gogol. Somebody with # better perl skillz, please help # NOTE: The bookmark parsing REQUIRES that myfilm.pl is in your PATH # # 1.02 2006/05/13 # ---------------- # + Updated for new youtube obfuscation (&t=[c0de]) # # 1.01 2006/04/08 # ---------------- # + Released as myfilm # + Now handles youtube as well as iFilm # # 1.00 2005/12/08 # ---------------- # + Released as diFilm # ################################################## #use strict; ################################################## # Setup the variables ################################################## my $PROGNAME = $0; $PROGNAME =~ s|.*/||; my ($BASENAME,$PROGNAME) = ($0 =~ m|(.*)/(.+)|) ? ($1?$1:'/',$2) : ('.',$0); # This will probably change.. my $IFILM = "http://www.ifilm.com/player/mac.jsp?ifilmId="; my $YOUTUBE = "http://youtube.com/get_video.php?l=165&video_id="; # How to fetch web files - pick one # Actual Safari agent example: # Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13 my $GET = "GET -H 'user-agent: Mozilla/5.0'"; my $LYNX = "links -source"; my $GET_URL = $LYNX; my $POST = "mov"; # For converting youtube to .mov my $FFMPEG = "ffmpeg"; #default save dir for youtube my $defdir = "/home/user/MyDocs/.videos"; #note no trailing slash ################################################## # Usage ################################################## sub fatal { foreach my $msg (@_) { print STDERR "[$PROGNAME] ERROR: $msg\n"; } exit(-1); } sub usage { foreach my $msg (@_) { print STDERR "ERROR: $msg\n"; } print STDERR <<USAGE; Usage:\t$PROGNAME [-d] <ifilm URL, youtube URL or ifilm id> Download an ifilm movie -o <file> Save to file -bw <56,200,300> Force a bandwidth other than your iFilm settings -d Set debug mode -bg Run ffmpeg in the background -z Scan /home/user/.bookmarks/MyBookmarks.xml for youtube video links. It will then download any that don't already exist in ~/MyDocs/.videos USAGE exit -1; } sub parse_args { my $opt = {}; while (my $arg=shift(@ARGV)) { if ($arg =~ /^-z$/) {$opt->{bmfile} = 1; next;} if ($arg =~ /^-h$/) { usage(); } if ($arg =~ /^-d$/) { $MAIN::DEBUG=1; next; } if ($arg =~ /^-bg$/) { $opt->{bg} = 1; next; } if ($arg =~ /^-bw$/) { $opt->{bw} = shift @ARGV; next; } if ($arg =~ /^-o$/) { $opt->{save} = shift @ARGV; next; } if ($arg =~ /^-/) { usage("Unknown option: $arg"); } if ($arg =~ m|^http://([^/]+)/.*?([^/]+)$|) { ($opt->{url}, $opt->{dom}, $opt->{film}) = ($arg, $1, $2); next; } if ($arg =~ /^[0-9]+$/) { ($opt->{arg}, $opt->{dom},$opt->{film}) = ("ifilm.com", $arg); next; } usage("Unknown film id. I need an iFilm or youtube URL"); } usage("No film URL specified.") unless $opt->{film} || $opt->{bmfile}; $opt; } sub debug { return unless $MAIN::DEBUG; foreach my $msg (@_) { print STDERR "[$PROGNAME] $msg\n"; } } ################################################## # Utils ################################################## sub title_embed { my ($opt, $url) = @_; debug("URL: $url"); my $open = "$GET_URL $url"; debug("GET: $open"); open(FILM,"$open |") || usage("Couldn't get URL: $url\nMake sure [$GET_URL] is installed"); # Find the film location my $dl; my $title; my $bw = $opt->{bw}; my $embed; my $and_t; while(<FILM>) { $dl = $1 if /var\s+dl\s*=\s*"?(-?\d+)"?/; $bw = $1 if !$bw && /var\s+bw\s*=\s*"?(\d+)"?/; $embed = $1 if /<embed.*(http:[^>"]+)/i; $title = $1 if /span class="title">([^<]+)/; $title = $1 if /<title>(.*)<\/title>/; $and_t = $1 if /video_id=.*&t=([^&"]+)/; } close(FILM); ($title,$embed,$dl,$bw,$and_t); } ################################################### #Bookmark parse ################################################### sub getbookmarks { my $BMARKS = "/home/user/.bookmarks/MyBookmarks.xml"; open BMARKS, "<$BMARKS" or die "Can't open bookmarks!: $!"; while (<BMARKS>) { chomp; if ($_ = m|(http://(?:www\.)?youtube\.com/watch\?v=[^"]+)|i){ push @youtube_vids, $1; } } print "Found ",($#youtube_vids + 1)," bookmarked videos:\n"; while ($ourcount < ($#youtube_vids+1) ) { print "$ourcount : $youtube_vids[$ourcount]\n"; @args = ("myfilm.pl", $youtube_vids[$ourcount]); $ourcount++; system(@args) == 0 or die "failed: $?\n"; } } ################################################## # iFilm ################################################## sub iFilm { my ($opt,$film) = @_; print STDERR "Fetching iFilm ID: $film\n"; # Read the ifilm HTML my $url = $IFILM.$film; my ($title,$smil,$dl,$bw) = title_embed($opt, $url); $title = $title || $film; usage("Couldn't find 'dl' key in URL [$url]") unless $dl; usage("Couldn't find 'bw' key in URL [$url]") unless $bw; usage("Couldn't find 'embed' tag in URL [$url]") unless $smil; $smil =~ s/'\s+\+\s+dl\s+\+\s+'/$dl/g; $smil =~ s/'\s+\+\s+bw\s+\+\s+'/$bw/g; $smil =~ s/"$//; debug("SMIL: $smil"); # Get the smil file my $open = "$GET_URL \Q$smil\E"; open(SMIL,"$open |") || usage("Couldn't get SMIL: $smil"); my $video; while (<SMIL>) { $video = $1 if /video src="(http[^"]+)"/; } usage("Couldn't find video source key in SMIL [$smil]") unless $video; close SMIL; debug("Found: $video"); $title =~ s/[:\s]+/_/g; my $save = $opt->{save} || "$title.$POST"; $save =~ s|/|_of_|g; print "Saving to: $save\n"; debug("$GET_URL \Q$video\E > \Q$save\E\n"); system("$GET_URL \Q$video\E > \Q$save\E"); } ################################################## # youtube ################################################## sub youtube { my ($opt, $film) = @_; print STDERR "Fetching youtube ID: $film\n"; # Get name my ($save,undef,undef,undef,$and_t) = title_embed($opt, $opt->{url}); fatal("No '&t=' code found for youtube [$opt->{url}]") unless $and_t; if ($opt->{save}) { $save = $opt->{save}; } else { fatal("No title found for youtube [$opt->{url}]") unless $save; $save =~ s/youtube( - )?(.+)/$2/ig; print STDERR "Found film '$save'\n"; $save =~ s/[:\s]+/_/g; } $save =~ s/(\.flv)?$/.flv/; $save =~ s|/|_of_|g; $save =~ s/[\*\?\'\"]//g; # Get rid of troublesome characters. # ffmpeg gets confused easily # Get video #print "TITLE; $title -> $save\n"; my $video = $YOUTUBE.$film."&t=$and_t"; debug("Video: $video"); $filename = join "/", $defdir, $save; print "$filename is filename\n"; if (-e $filename) { print "File $defdir/$save already exists, skipping.\n"; return; } print "Saving to: $defdir/$save\n"; system("$GET_URL \Q$video\E > $filename"); # Attempt convert to .mov #my $mov = $save; #$mov =~ s/\.flv$/.mov/; #print "Convert to: $mov\n"; #exec($FFMPEG,"-v",0,"-i",$save,$mov) unless fork; #if ($opt->{bg}) { # sleep 1; # To let the intial ffmpeg output go through.. #} else { # wait; } ################################################## # Main code ################################################## sub main { my $opt = parse_args(); if ($opt->{dom} =~ /youtube/i) { $opt->{film} = "watch?v=$opt->{film}" if $opt->{url} =~ s|www.youtube.com/v/|www.youtube.com/watch?v=|; usage("Couldn't find youtube video (URL must contain 'v=[video_id]')") unless $opt->{film} =~ /v=([a-z0-9_-]+)/i; return youtube($opt, $1); } if ($opt->{dom} =~ /ifilm/i) { usage("Couldn't find iFilm video (URL must contain a number/film id)") unless $opt->{film} =~ /([0-9]+)/; return iFilm($opt, $1); } if (defined $opt->{bmfile}) {&getbookmarks;} } main();
![]() |
2007-08-18
, 05:24
|
|
Posts: 177 |
Thanked: 57 times |
Joined on Aug 2007
@ Washington State, USA
|
#8
|
#!/usr/bin/perl # Filename: myfilm # Original Author: David Ljung Madison <DaveSource.com> # See License: http://MarginalHacks.com/License/ # Description: For use with the Nokia 770. The basic idea is to # browse youtube and bookmark videos you are interested in. # Drop to osso-xterm and run the script to batch download! my $VERSION= '1.02'; # # Requires that youtube's obfuscation doesn't change drastically. # # youtube: http://youtube.com/watch?v=[video_id] # video at: http://youtube.com/get_video.php?l=165&video_id=[video_id]&t=[??] # Need to find &t=[c0de] in HTML # # # Also see: http://javimoya.com/blog/youtube_en.php ################################################## # CHANGELOG ################################################## # 2007/8/16 # ---------------- # Haxxed for the 770 by gogol. Somebody with # better perl skillz should really clean it up! # # 1.02 2006/05/13 # ---------------- # + Updated for new youtube obfuscation (&t=[c0de]) # # 1.01 2006/04/08 # ---------------- # + Released as myfilm # + Now handles youtube as well as iFilm # # 1.00 2005/12/08 # ---------------- # + Released as diFilm # ################################################## #use strict; ################################################## # Setup the variables ################################################## my $PROGNAME = $0; $PROGNAME =~ s|.*/||; my ($BASENAME,$PROGNAME) = ($0 =~ m|(.*)/(.+)|) ? ($1?$1:'/',$2) : ('.',$0); # This will probably change.. my $YOUTUBE = "http://youtube.com/get_video.php?l=165&video_id="; # How to fetch web files - pick one # Actual Safari agent example: # Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13 my $GET = "GET --header 'user agent: Mozilla/4.0 (compatible; MSIE 6.0; ; Linux armv5tejl; U) Opera 8.02 [en_US] Maemo browser 0.4.34 N770/SU-18' "; my $wgetter = "wget -O -"; my $GET_URL = $wgetter; #default save dir for youtube my $defdir = "/home/user/MyDocs/.videos"; #note no trailing slash #bookmarks are where? my $BMARKS = "/home/user/.bookmarks/MyBookmarks.xml"; ################################################## # Usage ################################################## sub fatal { foreach my $msg (@_) { print STDERR "[$PROGNAME] ERROR: $msg\n"; } exit(-1); } sub usage { foreach my $msg (@_) { print STDERR "ERROR: $msg\n"; } print STDERR <<USAGE; Usage:\t$PROGNAME [-d] <youtube url> Download an ifilm movie -o <file> Save to file -bw <56,200,300> Force a bandwidth other than your iFilm settings -d Set debug mode -s Scan /home/user/.bookmarks/MyBookmarks.xml for youtube video links. It will then download any that don't already exist in ~/MyDocs/.videos USAGE exit -1; } sub parse_args { my $opt = {}; while (my $arg=shift(@ARGV)) { if ($arg =~ /^-s$/) {$opt->{bmfile} = 1; next;} if ($arg =~ /^-h$/) { usage(); } if ($arg =~ /^-d$/) { $MAIN::DEBUG=3; next; } if ($arg =~ /^-bg$/) { $opt->{bg} = 1; next; } if ($arg =~ /^-bw$/) { $opt->{bw} = shift @ARGV; next; } if ($arg =~ /^-o$/) { $opt->{save} = shift @ARGV; next; } if ($arg =~ /^-/) { usage("Unknown option: $arg"); } if ($arg =~ m|^http://([^/]+)/.*?([^/]+)$|) { ($opt->{url}, $opt->{dom}, $opt->{film}) = ($arg, $1, $2); next; } usage("Unknown film id. I need an iFilm or youtube URL"); } usage("No film URL specified.") unless $opt->{film} || $opt->{bmfile}; $opt; } sub debug { return unless $MAIN::DEBUG; foreach my $msg (@_) { print STDERR "[$PROGNAME] $msg\n"; } } ################################################## # Deobfuscation ################################################## sub title_embed { my ($opt, $url) = @_; debug("URL: $url"); my $open = "$GET_URL $url"; debug("GET: $open"); open(FILM,"$open |") || usage("Couldn't get URL: $url\nMake sure [$GET_URL] is installed"); # Find the film location my $dl; my $title; my $bw = $opt->{bw}; my $embed; my $and_t; while(<FILM>) { $dl = $1 if /var\s+dl\s*=\s*"?(-?\d+)"?/; $bw = $1 if !$bw && /var\s+bw\s*=\s*"?(\d+)"?/; $embed = $1 if /<embed.*(http:[^>"]+)/i; $title = $1 if /span class="title">([^<]+)/; $title = $1 if /<title>(.*)<\/title>/; $and_t = $1 if /video_id=.*&t=([^&"]+)/; } close(FILM); ($title,$embed,$dl,$bw,$and_t); } ################################################# #Bookmark Parsing ################################################# sub getbookmarks { open BMARKS, "<$BMARKS" or die "Can't open bookmarks for reading: $!"; while (<BMARKS>) { chomp; if ($_ = m|(http://(?:www\.)?youtube\.com/watch\?v=[^"]+)|i){ push @youtube_vids, $1; } } print "Found ",($#youtube_vids + 1)," bookmarked videos:\n"; while ($ourcount < ($#youtube_vids+1) ) { print "$ourcount : $youtube_vids[$ourcount]\n"; if ($MAIN::DEBUG == "3") { @args = ($PROGNAME, "-d", $youtube_vids[$ourcount]); } else { @args = ($PROGNAME, $youtube_vids[$ourcount]); } print "$args[0] $args[1] $args[2]\n"; $ourcount++; system(@args) == 0 or die "failed: $!\n"; } } ################################################## # youtube ################################################## sub youtube { my ($opt, $film) = @_; print STDERR "Fetching youtube ID: $film\n"; # Get name my ($save,undef,undef,undef,$and_t) = title_embed($opt, $opt->{url}); fatal("No '&t=' code found for youtube [$opt->{url}]") unless $and_t; if ($opt->{save}) { $save = $opt->{save}; } else { fatal("No title found for youtube [$opt->{url}]") unless $save; $save =~ s/youtube( - )?(.+)/$2/ig; print STDERR "Found film '$save'\n"; $save =~ s/[:\s]+/_/g; } $save =~ s/(\.flv)?$/.flv/; $save =~ s|/|_of_|g; $save =~ s/[\*\?\'\"\&\,]//g; # Get rid of troublesome characters.. $save =~ s/\(//g; $save =~ s/\)//g; #..including parentheses. debug("save: $save"); # Get video my $video = $YOUTUBE.$film."&t=$and_t"; debug("Video: $video"); $filename = join "/", $defdir, $save; debug("filename: $filename"); if (-e $filename) { print "File $defdir/$save already exists, skipping.\n"; #WOW the bookmarks xml SUCKS. Eventually we'll delete old links... #open BMARKS, "<$BMARKS"; @all = <BMARKS>; #foreach (@all) { #if(m|$film|i) { print; $_ = ""; print "Erased bookmark to already downloaded file.\n";} #} #open BMARKS, ">$BMARKS"; #foreach(@all) { # #print; # } #return; } print "Saving to: $defdir/$save\n"; system("$GET_URL \Q$video\E > $filename"); } ################################################## # Main code ################################################## sub main { my $opt = parse_args(); if ($opt->{dom} =~ /youtube/i) { $opt->{film} = "watch?v=$opt->{film}" if $opt->{url} =~ s|www.youtube.com/v/|www.youtube.com/watch?v=|; usage("Couldn't find youtube video (URL must contain 'v=[video_id]')") unless $opt->{film} =~ /v=([a-z0-9_-]+)/i; return youtube($opt, $1); } if (defined $opt->{bmfile}) {&getbookmarks;} } main();
![]() |
2007-08-18
, 22:15
|
Posts: 17 |
Thanked: 0 times |
Joined on Aug 2007
|
#9
|
![]() |
2007-08-20
, 23:14
|
Posts: 2 |
Thanked: 0 times |
Joined on Aug 2007
@ Arlington, TX
|
#10
|
-------
Hi all, I'm new here
I was really disappointed that I couldn't get youtube rtsp links from http://m.youtube.com to work with mplayer... so after a bit of hacking and googling I came up with this instead, which is actually a bit nicer since you aren't limited to teh mobile collection of vids:
Basically it involves a bash script that wgets (through the goofy youtube redirection that tries to hide the direct link to) the video and then plays it out, optionally deleting the file afterwards.
To do it I had to install bash and wget, available here:
bash
wget
..then make a script that goes like so:
chmod a+x your script and mv it to /usr/bin to make things easier later.
Obviously you'll also need the osso-xterm package installed, I'm assuming if you got this far you have it already.
Then you just copy the name of the vid you want to watch, paste it in to the terminal after the name of your script and away you go!
Now, is there any way to expediate this? Copy/open terminal/paste... Can mplayer stream the unmungled http link directly? Any ideas?
Last edited by gogol; 2007-08-18 at 05:38. Reason: to point to updated script