/usr/share/perl5/FlashVideo/Site/Adultswim.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 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 | # Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::Adultswim;
use strict;
use FlashVideo::Utils;
our $VERSION = '0.02';
sub Version() { $VERSION; }
sub find_video {
my($self, $browser, $embed_url) = @_;
my $xml;
my $id;
my $segIds;
if($browser->{content} =~ m/(<meta[^>]* ?name=["']segIds["'] ?[^>]*>)/){
my $text = $1;
if($text =~ m/content=["']([^"']+)["']/){
$segIds = $1;
}
}
($segIds)=$browser->{content} =~ m/<section[^>]* ?data-segment-ids=["'](.+?)["'] ?[^>]*>/ if(!$segIds);
my ($id1) = $segIds =~ m/^([0-9a-f]+)/;
my $title;
if($browser->{content} =~ m/<meta property=["']og:title["'] content=["']([^"']+)["']\/>/){
$title = $1;
}
my $configURL = "/tools/swf/player_configs/watch_player.xml";
# foreach($xml->{head}->{script}){
if($browser->content =~ /pageObj\.configURL = ["']([^"']+)["'];/) {
$configURL = $1;
}
# }
$browser->get($configURL);
my $serviceConfigURL;
if($browser->response->code =~ /^30\d$/){
$xml = from_xml($browser);
if($xml->{serviceConfigURL} ne ""){
$serviceConfigURL = $1;
}
} else {
$serviceConfigURL = "http://asfix.adultswim.com/staged/AS.configuration.xml";
}
$browser->get($serviceConfigURL);
$xml = from_xml($browser);
my $getVideoPlayerURL;
if($xml->{config}->{services}->{getVideoPlaylist}->{url} ne ""){
$getVideoPlayerURL = $1;
} else {
$getVideoPlayerURL = "http://asfix.adultswim.com/asfix-svc/episodeservices/getVideoPlaylist?networkName=AS";
}
my $videoURL = "$getVideoPlayerURL&id=$id1";
$browser->get($videoURL);
$xml = from_xml($browser);
my $bitrate=-1;
my $file_url;
foreach(@{$xml->{entry}}){
next if(ref($_) ne 'HASH');
next if ($_->{ref}->{href} =~ m,\.akamaihd\.net\/,);
next if ($_->{param}->{bitrate} < $bitrate && $_->{ref}->{href} =~ m/iPhone/);
$file_url=$_->{ref}->{href};
$bitrate=$_->{param}->{bitrate};
#print STDERR $_->{param}->{bitrate}."\t".$_->{ref}->{href}."\n";
}
return $file_url, title_to_filename($title);
}
1;
|