Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: How to save an offline video i just watched on my browser without having to download

  1. #11
    Join Date
    Jul 2011
    Beans
    36

    Re: How to save an offline video i just watched on my browser without having to downl

    Quote Originally Posted by s1baker View Post
    Here is a script that David Ljung Madison wrote that will allow you to copy a flash that you viewed so that you can save it.
    I have a separate folder that I have this script in. After the flash vid is viewed/downloaded, I go to the folder and run this script.

    Code:
    #!/usr/bin/perl
    # Filename:	flashcache
    # Author:	David Ljung Madison <DaveSource.com>
    # See License:	http://MarginalHacks.com/License/
    # Description:	Copy flash files in your browsers cache
    # Dependencies:	Unix command 'lsof'
    use strict;
    
    ##################################################
    # Setup the variables
    ##################################################
    my $PROGNAME = $0; $PROGNAME =~ s|.*/||;
    
    my $LSOF = 'lsof';
    
    my $FIND = 'flash';	# Find flash files
    my $POST = 'flv';	# Postfix to save to
    
    # Where we save files
    #   %f is $FIND
    #   %d is the next available number
    #   %p is .$POST
    my $DEST = "found%f.%d%p";
    
    ##################################################
    # 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]
      Copies deleted flash files currently open in your browser's cache
      -d             Set debug mode
      -find <str>    What to search for  [default $FIND]
      -post <str>    Postfix for saving files [default $POST]
      -dest <str>    Or just specify full destination [default $DEST]
                     (see the script for meanings of %f, %d, %p)
    
    USAGE
    	exit -1;
    }
    
    sub parseArgs {
    	usage("You need to be on a system that uses /proc") unless -d '/proc';
    
    	my $opt = {
    		find => $FIND,
    		post => $POST,
    		dest => $DEST,
    	};
    	while (my $arg=shift(@ARGV)) {
    		if ($arg =~ /^-h$/) { usage(); }
    		if ($arg =~ /^-d$/) { $MAIN::DEBUG=1; next; }
    		if ($arg =~ /^-find$/) { $opt->{find} = shift(@ARGV); next; }
    		if ($arg =~ /^-post$/) { $opt->{post} = shift(@ARGV); next; }
    		if ($arg =~ /^-dest$/) { $opt->{dest} = shift(@ARGV); next; }
    		if ($arg =~ /^-/) { usage("Unknown option: $arg"); }
    		usage("Too many files specified [$arg and $opt->{file}]") if $opt->{file};
    	}
    
    	usage("You need to specify a destination with -dest")
    		unless $opt->{dest};
    	
    	usage("You need to specify something to search for with -find")
    		unless $opt->{find};
    	
    	$opt;
    }
    
    sub debug {
    	return unless $MAIN::DEBUG;
    	foreach my $msg (@_) { print STDERR "[$PROGNAME] $msg\n"; }
    }
    
    ##################################################
    # Main code
    ##################################################
    sub findFiles {
    	my ($opt) = @_;
    	my @found;
    	# 'lsof /'  (The '/' just does files, no sockets, and is faster)
    	open(LSOF,"$LSOF /|") || usage("Can't run [$LSOF]");
    	while (<LSOF>) {
    		next unless /delete/i;
    		next unless /\Q$opt->{find}\E/i;
    		chomp;
    		# procname  pid  user   fd
    		usage("Found it, can't parse it [$_]")
    			unless /^\S+\s+(\d+)\s+\S+\s+(\d+)/;
    		push(@found, [$1,$2]);
    	}
    	usage("Couldn't find any deleted cached $opt->{find} files")
    		unless @found;
    	@found;
    }
    
    sub procPath {
    	my ($pid,$fd) = @_;
    	my $path = "/proc/$pid";
    	usage("Couldn't find $path") unless -d $path;
    	$path .= '/fd';
    	usage("Couldn't find $path") unless -d $path;
    	$path .= "/$fd";
    	usage("Couldn't read $path") unless -e $path;
    	$path;
    }
    
    sub destPath {
    	my ($opt) = @_;
    	my $p = $opt->{dest};
    	$p =~ s/%f/\Q$opt->{find}\E/g;
    	$p =~ s/%p/.\Q$opt->{post}\E/g;
    	my $num = 0;
    	my $path;
    	do {
    		$path = $p;  $num++;
    		$path =~ s/%d/$num/g;
    	} until ! -f $path;
    	$path;
    }
    
    sub main {
    	my $opt = parseArgs();
    	
    	my @found = findFiles($opt);
    	foreach my $found ( @found ) {
    		my $src = procPath(@$found);
    		my $dest = destPath($opt);
    		print "$src -> $dest\n";
    		system("/bin/cp",$src,$dest);
    	}
    }
    main();
    In what folder should i save the script, and in which folder is the supposed to be saved.........confused.

  2. #12
    Join Date
    Nov 2011
    Location
    Michigan
    Beans
    60
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to save an offline video i just watched on my browser without having to downl

    I just replied to another thread you got started along these same lines.

    The easiest thing I've found is do "google" DownLoadHelper. It's a plugin for most browsers including Firefox.
    It's almost too easy to use.

    By the way..... I'm not sure I know of a way to save anything without downloading it unless you just save the url. But then I'm no geek.

    Morhin


  3. #13
    Join Date
    Nov 2006
    Beans
    432

    Re: How to save an offline video i just watched on my browser without having to downl

    @rpupa

    do this :
    First, make a folder in your home directory. I called mine "scripts"

    1) Copy the script file. ( hold down left mouse button and
    select all of the script file. Release left button and hit right button of the mouse and select copy )
    2) Open gedit and paste the file in it ( hit right button
    on the mouse and select "paste" )
    3) Save the file in the folder that you created
    4) Give the script file a name, anything will do. ( I just called mine "flashcache" ), and
    you don't need to give the name an extension.
    4) 'right' click on this file.
    5) Select properties and then permissions and check the "allow executing the file as a program". Now you are set to go.

    6) After you watch a .flv file on your browser , or otherwords, after it has downloaded, go to the folder where
    the script file is and 'left' click on the script file with the mouse.
    7) You should see options saying that it is an executable text file. 'left' click the mouse on "run".

    8) After it runs, you should see a file appear in the folder. This is the last flv file you just watched. It will probably be named "foundflash.1.flv"
    Rename it what you want.
    9) You should be able to open it and view it with "movieplayer" or "vlc" player, or whatever
    you use to view flv files.

    ~Also, you may want to get the add-on "downloadhelper" for Firefox

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •