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

Download error recently on Android for some podcasts #2161

Open
EricKerby opened this issue Apr 19, 2024 · 11 comments
Open

Download error recently on Android for some podcasts #2161

EricKerby opened this issue Apr 19, 2024 · 11 comments
Assignees
Labels
bug Something isn't working ready to deploy The work has been approved and merged

Comments

@EricKerby
Copy link

I'm recent weeks I started experiencing what seems like #1736 but on Android and for just some podcast feeds. I've tried logging out and back in on Podverse and unsubscribing and resubscribing to the affected podcasts with no success. Playing a stream works, but downloading an episode quickly fails and shows just "Error" in the My Library Downloads. Downloads of many other podcasts continue working fine.

Podcasts with issue for me are New Heights and The Bobby Bones Show.

Using Podverse 4.16.0 Build 5262 on Android 14 on a Pixel 7

Screenshot_20240418-205222

@EricKerby EricKerby added the bug Something isn't working label Apr 19, 2024
@mitchdowney
Copy link
Member

@EricKerby thanks for creating this. Funny coincidence...I was just made aware of this in our Discord and have been investigating it for the past 10 minutes.

It seems the error is happening because after updating the react-native-background-downloader library in v4.16.0, some episodes are now returning a "too many redirects" error message. I imagine there must be a way for us to increase the number of redirects allowed by the downloader service.

For more context, one of the podcasts with the error is Pod Save America. Here is a link to the mp3 from their RSS feed:

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

And I just checked New Heights with Jason and Travis Kelce, and their mp3 looks like:

https://pdst.fm/e/pscrb.fm/rss/p/claritaspod.com/measure/chrt.fm/track/DA31CA/chrt.fm/track/F88GEG/arttrk.com/p/BLPSN/traffic.megaphone.fm/BSN1763591196.mp3?updated=1713367602

When I run curl on these it says 6 redirects.

Anyway, hoping to find a quick solution for increasing the number of redirects allowed.

@mitchdowney
Copy link
Member

A fix for this should be in v4.16.1.

@mitchdowney mitchdowney self-assigned this Apr 19, 2024
@mitchdowney mitchdowney added the ready to deploy The work has been approved and merged label Apr 19, 2024
@mitchdowney mitchdowney removed the ready to deploy The work has been approved and merged label Apr 22, 2024
@mitchdowney mitchdowney reopened this Apr 22, 2024
@mitchdowney
Copy link
Member

My fix was incomplete. I only fixed it for urls prefixed with the pdst.fm domain, but it turns out there are many other redirect tracking troublemaker domains...

The fix I put in was to send pdst.fm mp3 urls to our "url resolving endpoint," then to send the final resolved url to the front-end.

Ideally a more proper fix for this would happen on the client-side, but I have barely any Android skills, which makes it difficult for me to fix. Maybe however the code can be done with just JavaScript and I am overthinking it.

I created kesha-antonov/react-native-background-downloader#15 for @kesha-antonov's library we use for downloading mp3, and it'd be nice if the library handled "too many redirects" itself, but based on the fact no one else has created an issue for it sooner, maybe it's not a common problem people are running into.

Here are more examples of podcast urls that are failing due to "too many redirects":

<enclosure length="46055925" type="audio/mpeg" url="https://dts.podtrac.com/redirect.mp3/chrt.fm/track/8DB4DB/pdst.fm/e/pfx.vpixl.com/6qj4J/nyt.simplecastaudio.com/fa58abbf-ea07-4e56-95be-3c078f65b2f9/episodes/b137d9bd-385b-48c1-ab21-9586b873bd2c/audio/128/default.mp3?aid=rss_feed&awCollectionId=fa58abbf-ea07-4e56-95be-3c078f65b2f9&awEpisodeId=b137d9bd-385b-48c1-ab21-9586b873bd2c&feed=Kctn1RDB"/>

<enclosure length="53529417" type="audio/mpeg" url="https://chrt.fm/track/D1246F/dts.podtrac.com/redirect.mp3/pdst.fm/e/pscrb.fm/rss/p/mgln.ai/e/275/afp-27275-injected.calisto.simplecastaudio.com/aa5424c1-b7ed-4668-a39c-473d31465df6/episodes/8bd8dfdf-8f50-423b-b357-945b24f3ee27/audio/128/default.mp3?aid=rss_feed&awCollectionId=aa5424c1-b7ed-4668-a39c-473d31465df6&awEpisodeId=8bd8dfdf-8f50-423b-b357-945b24f3ee27&feed=bOogzwqU"/>

<enclosure url="https://chtbl.com/track/5899E/podtrac.com/pts/redirect.mp3/pscrb.fm/rss/p/traffic.omny.fm/d/clips/e73c998e-6e60-432f-8610-ae210140c5b1/78d30acb-8463-4c40-a5ae-ae2d0145c9ff/5ba782ff-4a29-4b7c-91d2-b157001878f4/audio.mp3?utm_source=Podcast&in_playlist=d64f756d-6d5e-4fae-b24f-ae280140ad36" length="207216801" type="audio/mpeg"/>

<enclosure url="https://chtbl.com/track/9EE2G/dts.podtrac.com/redirect.mp3/pdst.fm/e/rss.art19.com/episodes/ea42f5e0-9437-425d-b06e-eda7fce5cb10.mp3?rss_browser=BAhJIgtDaHJvbWUGOgZFVA%3D%3D--d05363d83ce333c74f32188013892b2863ad051c" type="audio/mpeg" length="21433782"/>

image

image

@lovegaoshi
Copy link
Contributor

not like podverse will migrate to the RN-fetch-blob family of downloaders, but these ones do work with redirect;
also @mitchdowney for a hack try this: fetch with method HEAD and return Response.url
(await fetch(url, {method": HEAD"})).url
I use them in separate
https://github.com/lovegaoshi/azusa-player-mobile/blob/dev/src/utils/mediafetch/headRequest.ts#L8
https://github.com/lovegaoshi/azusa-player-mobile/blob/master/src/utils/mediafetch/b23tv.ts
dunno if this overhead would be worth it, since not all have this redirect problem. but the urls you quoted works with this hack

@mitchdowney
Copy link
Member

@lovegaoshi thanks for your help. I didn't realize it was so easy to follow redirects with a HEAD request and axios (which we're using in PV). I started by trying to use a follow-redirects library but found it was Node.js only.

Anyway, I think I have a fix implemented for Podverse Android in v4.16.2.

@mitchdowney mitchdowney added the ready to deploy The work has been approved and merged label Apr 26, 2024
@mitchdowney
Copy link
Member

This should be fixed for good in v4.16.2 🤞

@mitchdowney
Copy link
Member

More download errors, this time for BBC podcasts 😩

When I check Logcat, it looks like they have an insecure URL somewhere in their redirects, and it results in a "cleartext not allowed" error.

We have an API service that is supposed to get the HTTPS version of URLs, but it apparently isn't working for this case.

@mitchdowney mitchdowney reopened this May 7, 2024
@mitchdowney mitchdowney removed the ready to deploy The work has been approved and merged label May 7, 2024
@mitchdowney
Copy link
Member

New fix attempted in v4.16.3.

@mitchdowney mitchdowney added the ready to deploy The work has been approved and merged label May 7, 2024
@archtur
Copy link

archtur commented May 30, 2024

I

  1. reinstalled Podverse 4.16.3 from F-Droid right now,
  2. disabled auto downoads for new podcasts
  3. added a Podcast (https://podverse.fm/podcast/3JERV6OYpu)
  4. clicked on download of the first Episode

The download is simply stucking.
Screenshot_20240530-100018_Trebuchet

The direct playback is working.

@lovegaoshi
Copy link
Contributor

i cant reproduce with the same podcast.

is this reproducible and could u post adb logs and/or willing to use android studio or a debug build to pin down the issue?

@archtur
Copy link

archtur commented May 31, 2024

In General yes.

Connecting via adb is no issue I think. Is it enough to connect via USB and run adb logcat ...? If yes it would be great if you could provide me the exact command with filters.

For the debugging approach: it depends how much time I need for installing Android Studio (manjaro linux - I expect it is fast) and for debugging (I never did this).

Regarding debug builds: I will not use binary packages from everyone. If they are build by the official maintainer ( @mitchdowney ) it would be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready to deploy The work has been approved and merged
Projects
None yet
Development

No branches or pull requests

4 participants