Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bandwidth settings occasionally broken by unexpected stream URLs #1282

Open
natumbri opened this issue Jan 9, 2019 · 0 comments
Open

Bandwidth settings occasionally broken by unexpected stream URLs #1282

natumbri opened this issue Jan 9, 2019 · 0 comments

Comments

@natumbri
Copy link

natumbri commented Jan 9, 2019

Occasionally, SBS on Demand returns a stream URL that is not in the standard format. For example, Das Boot S1, E7.

The URL for Das Boot S1, E6 is, as expected, http://sbsvodns-vh.akamaihd.net/i/vod/SBS_Production/managed/2018/12/10/630546_,1500,1000,512,128,K.mp4.csmil/master.m3u8?__b__=500&b=0-2000&__a__=off&set-akamai-hls-revision=5

However, the URL for Das Boot S1, E7 is http://videocdn.sbs.com.au/u/video/SBS_Production/managed/2018/12/10/630547_1500K.mp4

The URL for E7 does not include a &b=n-nnnn field, and so breaks bandwidth selection.

A way around this is to replace the 1500 at the end of the URL with the size of the stream you want. So, if you want Das Boot S1 E7 in 512Kb/s, the revised URL would be http://videocdn.sbs.com.au/u/video/SBS_Production/managed/2018/12/10/630547_512K.mp4

Including something like the following in play.py would probably fix it:

    if ('videocdn' in stream_url):    #and/or '&b=' not in stream_url?
        if bandwidth == '0':                                                                                         
            stream_url = re.sub(r'_\d{3,4}K\.mp4', '_512K.mp4', stream_url)                                            
        elif bandwidth == '1':                                                                                         
            stream_url = re.sub(r'_\d{3,4}K\.mp4', '_1000K.mp4', stream_url)

I have no idea how often this happens, or whether - when it does - it is consistent.

Cheers,
Nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant