am;
$self->{'cnt'}++;
}
}
} else { #EXTRACT PODCAST PAGE DATA FROM EMBEDDED, ENCODED JSON:
$html = HTML::Entities::decode_entities($html);
$html = uri_unescape($html);
$html =~ s#\\
FAILED, INVALID STATION URL, PUNT!
my $json = '';
$json = $1 if ($html =~ s#\btype\=\"application\/json\"\>\{(.+)##s);
if ($json) {
print STDERR "..JSON data found, fetching data we can here fi
;
my $podcastdata = ($json =~ s#^(.+?)\"episodes\"\:##s) ? $1 : '';
while ($json =~ s#^.+?\"title\"\:\"([^\"]+)\"##so) {
my $epititle = $1;
my $epistream = ($json =~ m#\"file\_url\"\:\"(
($epititle && $epistream);
next if ($self->{'secure'} && $epistream !~ /^https/o);
if ($json =~ m#\"url\"\:\"([^\"]+)\"#so) {
$have1stepisode ||= $1;
$epistream =~ s/\.(mp3|m3u8|pl
ined($embedded_video) && $embedded_video->count() > 0);
##NEXT, TRY FOR YOUTUBE URLs HIDDEN IN JSON:
while ($html && $html =~ s#\"url\"\:\"([^\"]+)\"\,##so) {
my $one = $1;
my $embeddedU
unless ($self->{'notrim'});
$url2fetch = $embeddedURL;
print STDERR "--embedded YOUTUBE JSON url=$url2fetch=\n" if ($DEBUG);
$self->{'_isaYtPage'} = 1;
$self->{'id'} = $1 if ($url2
#/o);
($atr, $val) = split(/\s*\=\>\s*/o, $_, 2);
eval "\$self->{'$atr'} = $val"; #CATCH JSON-LIKE ARGS, IE. "arg => {key => value, ...}"
eval "\$self->{'$atr'} = \"\Q$val\E\"" if ($@);
#STEP 1 FAILED, INVALID PODCAST URL, PUNT!
if ($html =~ m#\<script\s+type\=\"application\/ld\+json"\>(.+?)\<\/script\>#s) {
my $epidata = $1;
if ($epidata =~ m#\"associatedMedia\"\:\{([^\}]+
306741546438020584b9
my $tryStream = "https://opml.radiotime.com/Tune.ashx?id=$stationID&render=json";
print STDERR "-2 (we're a station) FETCHING URL=$tryStream=\n" if ($DEBUG);
my $response =
on\/ld\+json\"\>\s*\{([^\}]+)#s) {
my $jsonstuff = $1;
my $streams = '';
$self->{'title'} = $1 if ($jsonstuff =~ m#\"name\"\:\s*\"([^\"]+)#s);
#x $self->{'description'} = $1 if ($jsonstuff =~
if ($jsonstuff =~ m#\"thumbnailUrl\"\:\s*\"([^\"]+)#s);
($self->{'imageurl'} = $self->{'iconurl'}) =~ s#^.+?(https?\:\/.+)$#$1#i
if ($self->{'iconurl'});
$self->{'year'} = $1 if ($jsonstuff