Problem downloading 'shetland'
fred.d
fred.d at timelords.org.uk
Sat Nov 14 02:56:13 PST 2026
I took a quick look last night and it's obvious how to fix at that
level. The question tho' is does that change satisfy all the
requirements to deliver the right solution?
i.e. if the value is 0 before the assignment is made, does assuming any
other answer (thus allowing it to continue) still deliver the right
result for the calculations and checks being performed?
Without understanding what it's doing - and I don't - it seemed safer to
wait until someone who does have some understanding fixed it.
Meanwhile the published workaround allows you to download all of these (
I had about 8 that I wanted to get and they all came down fine using the
workaround)
https://github.com/get-iplayer/get_iplayer/issues/524#issuecomment-6798973037
On 14/11/2026 09:05, John Bingham wrote:
> Hi all
>
> I'll try again. Didn't know that the list doesn't accept html and I
> had pasted some in. Hopefully, I've now "plain-texted" it now.
>
> ------
>
> I had the same problem a couple of days ago. I used Google Gemini to
> fix it.
>
> I have been using the modified version since 11 November with no
> further problems.
>
> I guess that I could upload my version which I have as
> /usr/local/bin/get_iplayer on Ubuntu. Since it's a Perl script I
> guess that it would run under any OS if you can find where to put it
>
> Here is what Gemini said was the problem:
>
> The fix addressed a division-by-zero error that occurred when parsing
> HLS/DASH stream manifests (specifically within the timescale
> calculations where a manifest attribute or time scale factor evaluated
> to 0).
>
> Comparing the official v3.36 source against the patched version, the
> adjustment added a safety check/guard condition to prevent illegal
> division when the timescale or duration denominator is missing, zero,
> or uninitialized.
> Summary of the Code Difference
>
> Official Version: Directly divides a time value or calculates
> timestamps using a parsed timescale/duration factor straight from the
> manifest data:
> Perl
>
> # Conceptual representation of official logic
> $val = $timestamp / $timescale;
>
> If an incoming manifest lacks a valid timescale or supplies a
> value of 0, Perl throws a fatal exception: Illegal division by zero at
> get_iplayer line ... and aborts the stream recording.
>
> Patched Version: Wrapped or guarded the calculation to verify that
> the denominator is a valid, non-zero number before executing the
> division:
> Perl
>
> # Patched logic with guard condition
> $val = $timescale ? ($timestamp / $timescale) : 0;
>
> (Or an equivalent conditional check ensuring that if $timescale ==
> 0, it defaults safely or skips the calculation instead of crashing).
>
> This simple guard prevents the script from crashing when parsing
> specific stream manifests that return a zero timescale value.
>
>
> On 14/11/2026 05:05, Owen Randle wrote:
>> On Fri, 13 Nov 2026 at 18:37, Jimmy Aitken <jimmy.aitken at gmail.com>
>> wrote:
>>> Anyone else get this:
>>>
>>> % get_iplayer shetland: -g
>>>
>>> Matches:
>>> 6596: tv, Shetland: Series 11 - Episode 1, BBC One, m003445v
>>> INFO: 1 matching programmes
>>>
>>> WARNING: A UK TV licence is required to access BBC iPlayer TV
>>> content legally
>>> INFO: Processing tv: 'Shetland: Series 11 - Episode 1 (m003445v)'
>>> Illegal division by zero at
>>> /usr/local/get_iplayer/perl/bin/get_iplayer line 6256.
>>>
>>> No other programs seem to have issues, as I found out after debugging
>>> when I thought it was a dependency issue for a couple of hours.....
>>>
>>> J.
>>>
>>> _______________________________________________
>>> get_iplayer mailing list
>>> get_iplayer at lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/get_iplayer
>>
>> Yes, I've also recently been experiencing this error with a few
>> programmes
>> - e.g. the 'Shift the Thrift' series, where most episodes give the
>> exact same error
>> (even when trying to direct download using the pid, so a permanent
>> issue with those, - And irrespective of any specified tvquality or
>> output folder etc.)
>>
>> All of these episodes (< 30days since last shown) listed by
>> get_iplayer, produce this divide-by-0 error::
>> Shift the Thrift: Series 1 - Chepstow, BBC One, m002v3hg
>> Shift the Thrift: Series 1 - Harrogate, BBC One, m002v3j3
>> Shift the Thrift: Series 1 - Abergavenny, BBC One, m002v3kr
>> Shift the Thrift: Series 1 - Eastbourne, BBC One, m002v3lg
>>
>> Although this one episode (< 30days since last shown) does download
>> OK (so not quite-all episodes for this programme, produce the error)
>> Shift the Thrift: Series 1 - Aberystwyth, BBC One, m002v3gq
>>
>> So I presume there is something in some of these programme's episodes
>> metadata (maybe recently being changed by the BBC, if not seen before)
>> that is upsetting get_iplayer's script?
>> (Although you shouldn't really get fatal Illegal division by zero
>> errors from code, as proper defensive-programming should ensure these
>> conditions are trapped - Maybe just give a warning message about any
>> invalid metadata fields that could be producing this error)
>>
>> The problematic episodes listed above do all play OK directly on the
>> BBC iplayer website - where these are all available for the next
>> 4months.
>> (Although when the BBC recently temporarily took-down some of its
>> schedules / programmes webpages, to resolve PHP security issues, you
>> could still watch them via TV guide on iplayer, but get_iplayer
>> refused to download these, even via pid, if schedules etc content was
>> missing rather than being able to fall-back to some defaults / get
>> metadata from elsewhere on the BBC website)
>>
>> Owen
>>
>> _______________________________________________
>> get_iplayer mailing list
>> get_iplayer at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/get_iplayer
>
> _______________________________________________
> get_iplayer mailing list
> get_iplayer at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/get_iplayer
More information about the get_iplayer
mailing list