Group
Extension

App-get_flash_videos/lib/FlashVideo/Site/Ted.pm

# Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::Ted;
use strict;
use FlashVideo::Utils;

sub find_video {
  my ($self, $browser) = @_;

  my $url;
  if($browser->content =~ m{<a href="(/talks[^"]+)">Watch high-res video}) {
    $url = URI->new_abs($1, $browser->uri);
    $browser->allow_redirects;
  } else {
    die "Unable to find download link";
  }

  # TODO - support subtitles. Available in JSON (urgh):
  #   http://www.ted.com/talks/subtitles/id/453/lang/eng
  # The ID can be pulled out of flashvars:
  #   ti:"453"

  my $title = extract_title($browser);
  $title =~ s/\s*\|.*//;
  my $filename = title_to_filename($title, "mp4");

  return $url, $filename;
}

1;


Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.