/usr/share/perl5/FlashVideo/Site/Ustream.pm is in get-flash-videos 1.25~git2014.03.23-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 | # Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::Ustream;
use strict;
use FlashVideo::Utils;
use MIME::Base64;
our $VERSION = '0.01';
sub Version() { $VERSION };
sub find_video {
my ($self, $browser, $embed_url) = @_;
unless(eval { require Data::AMF::Packet }) {
die "Must have Data::AMF::Packet installed to download ustream videos";
}
my $packet = Data::AMF::Packet->deserialize(decode_base64(<<EOF));
AAAAAAABAA9WaWV3ZXIuZ2V0VmlkZW8AAi8xAAAAiAoAAAABAwAIYXV0b3BsYXkBAQAEcnBpbgIA
GHJwaW4uMC4xODM2MDk4NTkzMTY0Njg5OAAHdmlkZW9JZAIABzIzNTU3MzYAB3BhZ2VVcmwCACZo
dHRwOi8vd3d3LnVzdHJlYW0udHYvcmVjb3JkZWQvMjM1NTczNgAHYnJhbmRJZAIAATEAAAkK
EOF
my $title = extract_info($browser)->{meta_title};
# http://www.ustream.tv/recorded/\d+
my($video_id) = $browser->uri =~ m{recorded/(\d+)};
$video_id ||= $browser->content =~ m{vid\s*=\s*["']?(\d+)};
$packet->messages->[0]->{value}->[0]->{videoId} = $video_id;
my $data = $packet->serialize;
$browser->post(
# This is hidden as gwUrl inside the second loaded SWF
# (viewer.rsl.VER.swf), too much effort to extract properly.
"http://rgw.ustream.tv/gateway.php",
Content_Type => "application/x-amf",
Content => $data
);
die "Failed to post to Ustream AMF gateway"
unless $browser->response->is_success;
# Data::AMF fails to understand this response, so just parse ourselves.
my($flv_url) = $browser->content =~ /flv.{3,5}(http:[^\0]+)/;
$browser->allow_redirects;
return $flv_url, title_to_filename($title);
}
1;
|