App-get_flash_videos

 view release on metacpan or  search on metacpan

lib/FlashVideo/Generic.pm  view on Meta::CPAN

        ($actual_url) = eval { $self->find_video($sub_browser, undef, $prefs) };
      }
    }
  }

  my @filenames;
  
  return $actual_url, $possible_filename if $filename_is_reliable;

  $possible_filename =~ s/\?.*//;
  # The actual filename, provided it looks like it might be reasonable
  # (not just numbers)..
  push @filenames, $possible_filename if $possible_filename
    && $possible_filename !~ /^[0-9_.]+@{[EXTENSIONS]}$/;

  # The title of the page, if it isn't similar to the filename..
  my $ext = substr(($actual_url =~ /(@{[EXTENSIONS]})$/)[0], 1);
  push @filenames, title_to_filename($title, $ext) if
    $title && $title !~ /\Q$possible_filename\E/i;

  # A title with just the timestamp in it..

lib/FlashVideo/Generic.pm  view on Meta::CPAN

    }

    if($actual_url) {
      my $possible_filename = $filename || (split /\//, $actual_url)[-1];

      return $actual_url, $possible_filename, $filename_is_reliable;
    }
  }

  if($param =~ m{(rtmp://[^ &"']+)}) {
    info "This looks like RTMP ($1), no generic support yet..";
  }
  
  return;
}

sub guess_file {
  my($browser, $file, $once, $prefs) = @_;

  # Contains lots of URI encoding, so try escaping..
  $file = uri_unescape($file) if scalar(() = $file =~ /%[A-F0-9]{2}/gi) > 3;

lib/FlashVideo/Generic.pm  view on Meta::CPAN

        $browser->get($uri);
        $browser->delete_header("Range");

        if(FlashVideo::Downloader->check_magic($browser->content)
            || $uri =~ m!$video_re!) {
          # It's a video..
          debug "Found a video at $uri";
          return $uri;
        }

        # If this looks like HTML we have no hope of guessing right, so
        # give up now.
        return if $browser->content =~ /<html[^>]*>/i;

        if($browser->content =~ m!($video_re)!) {
          # Found a video URL
          return $1;
        } elsif(!defined $once
            && $browser->content =~ m!(http[-:/a-zA-Z0-9%_.?=&]+)!i) {
          # Try once more, one level deeper..
          return guess_file($browser, $1, 1, $prefs);

lib/FlashVideo/Site/Wat.pm  view on Meta::CPAN

  $browser->get("http://www.wat.tv/interface/contentv2/$video_id");

  my $title = json_unescape(($browser->content =~ /title":"(.*?)",/)[0]);
  my $url   = json_unescape(($browser->content =~ /files.*?url":"(.*?)",/)[0]);

  # Need to supply some other parameters
  $url .= "?context=swf2&getURL=1&version=WIN%2010,0,45,2";

  my $file_type = 'flv';

  # This *looks* like a video URL, but it actually isn't - URL is supplied
  # in the content of the response.
  $browser->head($url);
  
  if (!$browser->success) {
    die "Couldn't do HEAD request $url: " . $browser->response->status_line;
  }

  my $content_type = $browser->response->header('Content-Type');
  if ($content_type =~ /text/) {
    $browser->get($url);

t/url.t  view on Meta::CPAN


  DEBUG && diag "Files in directory: ", <*>;

  my @files = <*.{mp4,flv,mov}>;
  ok @files == 1, "One file downloaded";

  ok($files[0] !~ /^video\d{14}\./, "Has good filename");

  ok(FlashVideo::Downloader->check_file($files[0]), "File is a media file");

  ok -s $files[0] > (1024*200), "File looks big enough";

  chdir "..";
  rmtree $dir;
}

sub assemble_urls {
  my @urls;

  open my $url_fh, "<", "urls" or die $!;
  my $note;



( run in 0.534 second using v1.01-cache-2.11-cpan-64827b87656 )