/usr/share/perl5/FlashVideo/Site/Viafree.pm is in get-flash-videos 1.25.98-1.
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::Viafree;
use strict;
use warnings;
use FlashVideo::Utils;
use FlashVideo::JSON;
our $VERSION = '0.08';
sub Version() { $VERSION;}
sub find_video {
my ($self, $browser, $embed_url, $prefs) = @_;
my $bitrate_index = {
high => 0,
medium => 1,
low => 2
};
# If the url ends in a number that is the video id
my $video_id = ($embed_url =~ /.*\/([0-9]*)/)[0];
# If no number we look at image url to find video id
if ($video_id eq "") {
my $image_url = ($browser->content =~ /<meta property=\"og:image\" content=\"(.*?)\"\/>/)[0];
if (not $image_url eq "") {
$video_id = ($image_url =~ /\/inbox\/([0-9]*)\//)[0];
}
}
if ($video_id eq "") {
die "No video id found";
}
info "Got video_id: $video_id";
my $info_url = "http://playapi.mtgx.tv/v3/videos/$video_id";
my $stream_url = "http://playapi.mtgx.tv/v3/videos/stream/$video_id";
$browser->get($info_url);
my $json = from_json($browser->content);
my $title = $json->{title};
if ($prefs->{subtitles}) {
my $sub_url = "";
if (exists $json->{sami_path}) {
$sub_url = $json->{sami_path};
} elsif (exists $json->{subtitles_for_hearing_impaired}) {
$sub_url = $json->{subtitles_for_hearing_impaired};
}
if ($sub_url ne "") {
my $srt_name = title_to_filename($title, "srt");
$browser->get($sub_url);
convert_dc_subtitles_to_srt($browser, $srt_name);
} else {
info "No subtitles found!";
}
}
$browser->get($stream_url);
$json = from_json($browser->content);
# Prefer hls stream since it contains better video format
if ($json->{streams}->{hls}) {
my $hls_url = $json->{streams}->{hls};
my $filename = title_to_filename($title, "mp4");
return {
downloader => "hls",
flv => $filename,
args => { hls_url => $hls_url, prefs => $prefs }
};
}
# Fallback to rtmp stream if hls not available
my $filename = title_to_filename($title, "flv");
my $rtmp_med = $json->{streams}->{medium};
my $rtmp_data = {
'rtmp' => $rtmp_med,
'swfVfy' => "http://flvplayer.viastream.viasat.tv/flvplayer/play/swf/MTGXPlayer-2.0.6.swf",
'flv' => $filename
};
return $rtmp_data;
}
1;
|