any way to download this?

dinkypumpkin dinkypumpkin at gmail.com
Wed Mar 23 13:11:24 EDT 2011


On 23 Mar 2011, at 16:13, dinkypumpkin wrote:

> 
> On 23 Mar 2011, at 15:09, ZULU wrote:
> 
>> 
>> ----- Original Message ----- From: "Holger Rabbach" <hrabbach at fablemail.com>
>> To: <get_iplayer at lists.infradead.org>
>> Sent: Wednesday, March 23, 2011 2:24 PM
>> Subject: any way to download this?
>> 
>> 
>>> Hi,
>>> I'm trying to get get_iplayer to download the embedded video in the
>>> following page:
>>> http://www.bbc.co.uk/blogs/adamcurtis/2011/03/a_is_for_atom.html#
>>> I've tried several different ways, using the --url parameter, using the
>>> pid extracted from the page source (p00fq0p3) and using the playlist URL
>>> from the page source (http://www.bbc.co.uk/iplayer/playlist/p00fq0p3).
>>> None of these methods work... is there any way to download the video
>>> with get_iplayer?
>> 
>> It does not appear to be available <yet> on the iPlayer website.
>> ...or if it is, I can't find it!
> 
> It turns up on the website here:
> 
> http://www.bbc.co.uk/iplayer/episode/p00fq0p3/Adam_Curtis_A_is_for_Atom_from_Pandoras_Box_series/
> 
> But that probably won't help.  I got it to download, but only by making a couple of small modifications to get_iplayer.  Basically, get_iplayer doesn't understand the "Clip" resource type in the RDF file describing the programme.  A bug with > 2038 dates crops up as well.  I'll test it a few more times and then post my changes, though this probably isn't a generally useful feature.
> 

If you'd like to make quick hack to your copy of get_iplayer to get the A is for Atom video, the patch below shows what I had to do to make it work.  This NOT a general solution to handling resources of type Clip.  Since you have the PID that points to the clip itself, it will work more less like pointing get_iplayer to a normal programme episode.   However, clips (like episodes) may be in series, so additional RDF parsing would be necessary for a general treatment.  Consider this just a one-off solution to this particular problem.  At any rate, after making these changes, get_iplayer worked as normal with --pid p00fq0p3.  

The patch is below.  If it gets mangled in transmission, contact me off-list.  If it doesn't work for you, again, contact me off-list and I'll get video to you via another channel.

If any maintainers read this, I should point out that there seems to be a genuine bug in bounds checking of dates.  Only the year was being changed to reflect the limit of 32-bit unix time, but unix time runs on out 2038-01-19.  In this case, the expiry date in the metadata was 2041-03-17 23:59:00, which was changed to 2038-03-17 23:59:00, so the script bombed because the date was still invalid.  I can post in a separate patch if you prefer.


diff --git a/get_iplayer b/get_iplayer
index e13d3ea..593d515 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -4817,8 +4817,10 @@ sub get_time_string {
 	main::logger "DEBUG: $_ = $year, $mon, $mday, $hour, $min, $sec, $tzhour, $tzmin\n" if $opt->{debug};
 	# Sanity check date data
 	return '' if $year < 1970 || $mon < 1 || $mon > 12 || $mday < 1 || $mday > 31 || $hour < 0 || $hour > 24 || $min < 0 || $min > 59 || $sec < 0 || $sec > 59 || $tzhour < -13 || $tzhour > 13 || $tzmin < -59 || $tzmin > 59;
-	# Year cannot be > 2032 so limit accordingly :-/
-	$year = 2038 if $year > 2038;
+	# Date cannot be > 2038-01-19 03:14:07, so impose arbitrary limit of 2038-01-01 00:00:00
+	if ( $year >= 2038 ) {
+		($year, $mon, $mday, $hour, $min, $sec) = (2038, 1, 1, 0, 0, 0);
+	}
 	# Calculate the seconds difference between epoch_now and epoch_datestring and convert back into array_time
 	my $epoch = timegm($sec, $min, $hour, $mday, ($mon-1), ($year-1900), undef, undef, 0) - $tzhour*60*60 - $tzmin*60;
 	my $rtn;
@@ -5515,7 +5517,7 @@ sub get_pids_recursive {
 			return $prog->{pid};
 		}
 		# an episode-only pid page
-		if ( $rdf->{'po:Episode'} ) {
+		if ( $rdf->{'po:Episode'} || $rdf->{'po:Clip'} ) {
 			main::logger "INFO: Episode-only pid detected\n";
 			# No need to lookup - we already are an episode pid
 			push @pids, $prog->{pid};




More information about the get_iplayer mailing list