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

Is it possible to configure the number of redirects allowed using this library? #15

Open
mitchdowney opened this issue Apr 19, 2024 · 5 comments

Comments

@mitchdowney
Copy link

Hello! We recently deployed your fork into production in Podverse, but are running into a new error on Android. The error message is:

{"error": "ERROR_TOO_MANY_REDIRECTS", "errorCode": 1005}

This appears to be happening when attempting to download podcasts with an obnoxious amount of tracking prefix redirect services...for example, this very popular show has 6 redirects:

https://pdst.fm/e/chrt.fm/track/479722/arttrk.com/p/CRMDA/claritaspod.com/measure/pscrb.fm/rss/p/stitcher.simplecastaudio.com/9aa1e238-cbed-4305-9808-c9228fc6dd4f/episodes/b0c9a72a-1cb7-4ac9-80a0-36996fc6470f/audio/128/default.mp3?aid=rss_feed&awCollectionId=9aa1e238-cbed-4305-9808-c9228fc6dd4f&awEpisodeId=b0c9a72a-1cb7-4ac9-80a0-36996fc6470f&feed=dxZsm5kX

I'm trying to scan the documentation and code for a way to increase the number of redirects allowed, but haven't found anything yet. Is this something I can configure, or could this use case potentially need a patch?

@mitchdowney
Copy link
Author

I should add, I'm not certain that switching to your fork is what caused the new error. It's possible that the podcast networks experiencing this issue recently increased the number of tracking prefixes / redirects they used, and we're now running into this too many redirects error.

@mitchdowney
Copy link
Author

It seems like this might be a problem that apps can fix on their own with JS logic, either by coding it themselves or with a library like follow-redirects. I'll go ahead and try adding our own JS app implementation logic to follow redirects before loading a url into RNBD.

I'll leave this issue open in case you have ideas for how RNBD can handle an issue like this automatically, but feel free to close it if you don't feel like RNBD should handle these cases.

@kesha-antonov
Copy link
Owner

Hi

Wasn't aware of it but seems like on Android side DownloadManager doesn't work with redirects

https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/provider/Downloads.java#555

https://stackoverflow.com/a/13212978

Maybe it's good idea to add logic about redirects into this lib

@mitchdowney
Copy link
Author

@kesha-antonov ok good to know. As a workaround, I ended up adding a server-side endpoint that uses the follow-redirects library, and I am passing the hostnames that are known to cause trouble through that endpoint first, then getting the final redirected url, then sending it back to the client and loading the final url into RNBD.

Ideally this workaround wouldn't be necessary, so if you add redirect support I'd really appreciate it, but it's not a blocker for us so again not requierd.. Thanks for your quick response!

@kesha-antonov
Copy link
Owner

Thanks for the feedback! I'll think what can be done on lib's side

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

2 participants