App-get_flash_videos

 view release on metacpan or  search on metacpan

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


  # If this is an interview rather than a normal video, have to use a
  # different playlist URL. Interviews are actually separate videos, one
  # for each question.
  my $interview_clip;

  if ($browser->uri->as_string =~ m'/interview/'i) {
    $playlist_url =
      "http://www.videojug.com/views/interview/playlist.aspx?ar=16_9&id=";

    # Use the browser fragment (like #interview-question-here) to find out
    # which interview clip to download.
    $interview_clip = $browser->uri->fragment; 
  }

  # Get the video ID
  my $video_id;
  
  if ($browser->content =~
    /<meta name=["']video-id["'] content="([A-F0-9a-f\-]+)"/) {
    $video_id = $1;
  } else {
    die "Couldn't find video ID in Videojug page";

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

  die "Couldn't find video URL" unless $video_url;

  return $video_url, $filename;
}

sub get_prefix_and_title {
  my ($xml, $video_name) = @_;

  foreach my $media (@{ $xml->{Items}->{Media} }) {
    # This is frail, but try to go from the formatted video title to the
    # title in the same format as in the fragment.
    my $title = lc $media->{Title};
    $title =~ s/ /-/g;
    $title =~ s/[^a-z0-9\-]//g;

    if ($title eq $video_name) {
      return $media->{Prefix}, $media->{Title};
    }
  }

  die "Couldn't find prefix for video '$video_name'";

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

sub download_fmt_map {
  my($self, $prefs, $browser, $title, $info, $fmt_map) = @_;

  my $fmt_url_map = parse_youtube_format_url_map($fmt_map);

  if (!$title and $browser->uri->as_string =~ m'/user/.*?#') {
    # This is a playlist and getting the video title without the ID is
    # practically impossible because multiple videos are referenced in the
    # page. However, the encrypted (apparently) video ID is included in the
    # URL.
    my $video_id = (split /\//, $browser->uri->fragment)[-1];

    my %info = get_youtube_video_info($browser->clone, $video_id);

    $title = $info->{title};
  }

  # Sort by quality...
  my $preferred_quality = $prefs->quality->choose(map { $fmt_url_map->{$_->{id}}
      ? { resolution => $_->{resolution}, url => $fmt_url_map->{$_->{id}} }
      : () } @formats);



( run in 0.646 second using v1.01-cache-2.11-cpan-b16cb0d3907 )