Skip to content

Commit eac06ff

Browse files
committed
filter unwanted links from series nav
Closes #451
1 parent f65c7d9 commit eac06ff

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

get_iplayer

+6-1
Original file line numberDiff line numberDiff line change
@@ -5685,7 +5685,12 @@ sub fetch_episodes_recursive {
56855685
my $dom = XML::LibXML->load_html(string => $html, recover => 1, suppress_errors => 1);
56865686
if ( ! $check_series_nav ) {
56875687
my @hrefs = $dom->findnodes('//*[contains(@class,"series-nav")]//a/@href');
5688-
push @urls, "https://www.bbc.co.uk".$_->findvalue('.') for @hrefs;
5688+
for my $href (@hrefs) {
5689+
my $href_path = $href->findvalue('.');
5690+
my ($sid) = $href_path =~ /seriesId=([^\&]+)/i;
5691+
next if $sid && $sid !~ REGEX_PID;
5692+
push @urls, "https://www.bbc.co.uk".$href_path;
5693+
}
56895694
$has_series_nav = @hrefs;
56905695
$check_series_nav = 1;
56915696
}

0 commit comments

Comments
 (0)