[PATCH 1/2] Update handling of live channel URLs

dinkypumpkin dinkypumpkin at gmail.com
Wed Feb 29 16:12:49 EST 2012


At some point iPlayer live channel URLs gained '/watchlive'
or '/listenlive' suffixes.  The suffixes are now removed so
that those URLs may be used for recording live channels.
---
 get_iplayer |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/get_iplayer b/get_iplayer
index 5cf9995..77c13d5 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -6482,6 +6482,8 @@ sub clean_pid {
 	# If this is a BBC *iPlayer* Live channel
 	# e.g. http://www.bbc.co.uk/iplayer/playlive/bbc_radio_fourfm/
 	} elsif ( $prog->{pid} =~ m{http.+bbc\.co\.uk/iplayer}i ) {
+		# Remove trailing path for URLs like 'http://www.bbc.co.uk/iplayer/radio/bbc_radio_fourfm/listenlive'
+		$prog->{pid} =~ s/\/\w+live\/?$//;
 		# Remove extra URL path for URLs like 'http://www.bbc.co.uk/iplayer/playlive/bbc_one_london/' or 'http://www.bbc.co.uk/iplayer/tv/bbc_one'
 		$prog->{pid} =~ s/^http.+\/(.+?)\/?$/$1/g;
 	# Else this is an embedded media player URL (live or otherwise)
@@ -7376,6 +7378,8 @@ sub clean_pid {
 
 	# e.g. http://www.bbc.co.uk/iplayer/playlive/bbc_radio_fourfm/
 	} elsif ( $prog->{pid} =~ m{http.+bbc\.co\.uk/iplayer}i ) {
+		# Remove trailing path for URLs like 'http://www.bbc.co.uk/iplayer/radio/bbc_radio_fourfm/listenlive'
+		$prog->{pid} =~ s/\/\w+live\/?$//;
 		# Remove extra URL path for URLs like 'http://www.bbc.co.uk/iplayer/playlive/bbc_radio_one/'
 		$prog->{pid} =~ s/^http.+\/(.+?)\/?$/$1/g;
 
@@ -7449,6 +7453,8 @@ sub clean_pid {
 	#	# Just leave the URL as the pid
 	# e.g. http://www.bbc.co.uk/iplayer/playlive/bbc_radio_fourfm/
 	if ( $prog->{pid} =~ m{http.+bbc\.co\.uk/iplayer}i ) {
+		# Remove trailing path for URLs like 'http://www.bbc.co.uk/iplayer/radio/bbc_radio_fourfm/listenlive'
+		$prog->{pid} =~ s/\/\w+live\/?$//;
 		# Remove extra URL path for URLs like 'http://www.bbc.co.uk/iplayer/playlive/bbc_radio_one/'
 		$prog->{pid} =~ s/^http.+\/(.+?)\/?$/$1/g;
 
-- 
1.7.5.4




More information about the get_iplayer mailing list