Flash video downloader in perl

Andy Selby andyfrommk at googlemail.com
Mon Jan 26 15:14:55 PST 2009


I'm in the process of writing a program that downloads flash video
from sites that, unlike youtube, doesn't cache the file at
/tmp/Flash*, instead I'm having to visually search (because there are
no line breaks) /tmp/plugtmp*/plugin-PlaylistInfoService-1.asmx to
find the download link.
Here is what I've got so far

      1 #!/usr/bin/perl
      2
      3 use strict;
      4 use warnings;
      5
      6 while(<>)   #This will be replaced by a command to read
/tmp/plugtmp*/plugin-PlaylistInfoService-1.asmx
      7 {
      8 while (/\"\&gt\;(http\:\/\/flash\.vx\.roo\.com\/streamingVX\/\d*\/\d*\/(\d*|\d*\-\d*\-\d*)\_\w*.flv)\&lt/g)
      9 {
     10 print "$1\n";
     11 }
     12 }

What you need to do is go to a site that streams video but that video
isn't cached in /tmp/ (such as www.the-sun.co.uk and www.gm.tv) in a
browser and that will populate /tmp/plugtmp* with many files, the file
with the links in is named plugin-PlaylistInfoService-1.asmx (I
haven't been through the other files though, they're xml files which
are a mess of no spaces and no line breaks).
Then run the script thus
./myscript.pl < /tmp/plugtmp/plugin-PlaylistInfoService-1.asmx

At the moment all it does is print out the download links but its late
and I need to get up early tomorrow so that's as far as I got.
If you have the time to test it can you please tell me
1. If the file paths are valid for your distro (I'm on Fedora 10)
2. If you find a stream from another site than flash.vx.roo.com
3 An altogether different|better way to do what I'm doing

Thanks
Andy

That regex broken down

(/\"\&gt\;
    #anchor
(http\:\/\/flash\.vx\.roo\.com\/streamingVX\                 #the base
url, I assuming it never changes
/\d*\/\d*\/
    #directories
(\d*|\d*\-\d*\-\d*)
 #datestamp of filename
\_\w*.flv)
    #filename.flv
\&lt/g)
    #anchor


More information about the MiltonKeynes-pm mailing list