Description
See related issue I opened for Kivy: kivy.core.audio
- SoundLoader: support URLs as source, error handling and timeout #8591
I am working on an app where I'd like to offer the possibility of playing podcast audio files from their enclosure URLs.
For URLs from Buzzsprout ffpyplayer
gives me an 403 error (see at end a reproducible example). I think this error may be related to a server-side implementation, perhaps to combat scraping? The 403 does not happen when opening the link in a normal browser or when it is embedded in a webpage (see the same file playable here with an embedded player)
Is there scope for a feature request to:
-
Potentially avoiding errors like 403 -- if this is indeed a scraping defence then maybe supplying e,g. headers could avoid the issue?
-
Would it be possible to anticipate such errors by having some kind of pre-check option to see if the server-side supports play? This might allow me to e.g. not show the "play" button in the first place for these URLs in the app.
-
Have an option to handle all such fatal errors through exception handling? See the Kivy issue I raised:
ffpyplayer
does not raise an exception but rather returns some kind of error code meaning I cannot handle this in my code with "try/except": Kivy just carries on as if it worked OK and then crashes.
To reproduce the issue:
>>> from ffpyplayer.player import MediaPlayer
>>> ffplayer = MediaPlayer("https://www.buzzsprout.com/1984146/14507212-february-14-2024.mp3")
>>> [https @ 000001cbfcb4fd00] HTTP error 403 Forbidden
https://www.buzzsprout.com/1984146/14507212-february-14-2024.mp3: Server returned 403 Forbidden (access denied)
Activity