$urls =~ s/%([[:xdigit:]]{2})/chr(hex($1))/ge;
%urls = split(/[\|,]/, $urls);
$self->debug("Pagetype: 2010 (swfHTML), fmt_url_map");
+ } elsif ($e =~ m|\x27PLAYER_CONFIG\x27:\s+(.+)\}\);|) {
+ my $args = $1;
+ $self->debug("Found PLAYER_CONFIG: %s", $args);
+
+ $jsp = videosite::JSArrayParser->new();
+ $self->debug("Using %s to parse", ref($jsp));
+ $r = $jsp->parse($args);
+
+ unless(defined($r)) {
+ $self->error("Found information hash, but could not parse");
+ return undef;
+ }
+
+ if (exists($r->{'args'}) and exists($r->{'args'}->{'fmt_url_map'}) and ($r->{'args'}->{'fmt_url_map'} ne '')) {
+ my $urls = $r->{'args'}->{'fmt_url_map'};
+
+ $self->debug("Video has fmt_url_map: %s", $urls);
+
+ %urls = split(/[\|,]/, $urls);
+ foreach (keys(%urls)) {
+ my $u = $urls{$_};
+ $u =~ s/%([[:xdigit:]]{2})/chr(hex($1))/ge;
+ $urls{$_} = $u;
+ }
+ $self->debug("Pagetype: 2011 (PLAYER_CONFIG), fmt_url_map");
+ } else {
+ $self->error('fmt_url_map not found in PLAYER_CONFIG');
+ }
}
if (%urls) {