/usr/share/perl5/FlashVideo/Site/Traileraddict.pm is in get-flash-videos 1.25~git2012.06.27-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::Traileraddict;
use strict;
use FlashVideo::Utils;
use URI::Escape;
sub find_video {
my ($self, $browser) = @_;
my $video_id;
if ($browser->content =~ m'/em[db]/(\d+)') {
$video_id = $1;
}
else {
die "Unable to get Traileraddict video ID";
}
my $video_info_url = "http://www.traileraddict.com/fvar.php?tid=$video_id";
$browser->get($video_info_url);
if (!$browser->success) {
die "Couldn't download Traileraddict video info URL: " .
$browser->response->status_line;
}
# Get video information -- this helpfully includes metadata which could
# be useful for gfv's upcoming metadata feature.
my %info = parse_video_info($browser->content);
die "Couldn't find Traileraddict video URL" unless $info{fileurl};
$browser->head($info{fileurl});
if ($browser->response->is_redirect()) {
$info{fileurl} = $browser->response->header('Location');
}
my $type = $info{fileurl} =~ /\.mp4/i ? 'mp4' : 'flv';
return $info{fileurl}, title_to_filename($info{title}, $type);
}
sub parse_video_info {
my $raw_video_info = shift;
my %info;
# Raw video info are URL-encoded key=value pairs.
foreach my $pair (split /&/, $raw_video_info) {
$pair = uri_unescape($pair);
my ($name, $value) = split /=/, $pair;
$info{$name} = $value;
}
return %info;
}
1;
|