aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNigel Taylor <njtaylor0101@gmail.com>2013-04-04 09:28:22 -0700
committerNigel Taylor <njtaylor0101@gmail.com>2013-04-04 09:28:22 -0700
commit31ac09fa07787a391e16f8060b414436048d7379 (patch)
treec79f1b48d1f0b38d80e43a37f0a1c09e6328e3a9
parentdfb68b71689a5b0932ab020e6129c58c058f8db8 (diff)
parentb32fb116579f15cfdb2077493cda249d5d84ea31 (diff)
downloadget-flash-videos-31ac09fa07787a391e16f8060b414436048d7379.tar.gz
Merge pull request #112 from atomicdryad/updates
Fixed /video.adultswim.com
-rw-r--r--lib/FlashVideo/Site/Adultswim.pm35
1 files changed, 15 insertions, 20 deletions
diff --git a/lib/FlashVideo/Site/Adultswim.pm b/lib/FlashVideo/Site/Adultswim.pm
index fca786e..1ad2943 100644
--- a/lib/FlashVideo/Site/Adultswim.pm
+++ b/lib/FlashVideo/Site/Adultswim.pm
@@ -4,6 +4,9 @@ package FlashVideo::Site::Adultswim;
use strict;
use FlashVideo::Utils;
+our $VERSION = '0.02';
+sub Version() { $VERSION; }
+
sub find_video {
my($self, $browser, $embed_url) = @_;
@@ -18,10 +21,8 @@ sub find_video {
}
}
- my $id1;
- if($segIds =~ m/^([^#]*)#/){
- $id1 = $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=["']([^"']+)["']\/>/){
@@ -66,22 +67,16 @@ sub find_video {
$browser->get($videoURL);
$xml = from_xml($browser);
-
-# my $pick;
-# foreach(@{$xml->{entry}}){
-# if(!($_->{ref}->{href} =~ m/iPhone/)){
-# $pick = $1;
-# }
-# }
-
-# grep { $_->{name} eq "mimeType" } @{$_->{param}})[0]->{value}
-# my $pick = (grep { $_->{param}->{value}->[3] eq "video/x-flv" } @{$xml->{entry} } )[0];
-
- my $pick = $xml->{entry}[4];
-
- my $file_url = $pick->{ref}->{href};
-
- # $prefs->{quality}
+ 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);
}