youtube-music: [Bug]: Can't play content added from RSS feed such as podcast from soundcloud CORS issue?

Preflight Checklist

  • I use the latest version of YouTube Music (Application).
  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.
  • I understand that th-ch/youtube-music has NO affiliation with Google or YouTube

YouTube Music (Application) Version

3.2.2

Are you using the portable version of the YouTube Music Application?

  • I use the portable version of the YouTube Music Application.

What operating system are you using?

Other Linux

Operating System Version

Garuda Linux 6.7.0-AMD-znver2 (64-bit), KDE Plasma 5.27.10

What arch are you using?

x64

Last Known Working YouTube Music (Application) version

No response

Reproduction steps

  1. Open a track from an RSS/external audio source.
  2. Press play, it won’t work. To add an RSS source:
  3. Go to Library
  4. Click Podcasts (chip below Library tab in header)
  5. Click Add podcast
  6. Choose Add RSS feed
  7. Enter a podcast RSS feed URL, such as: https://feeds.soundcloud.com/playlists/soundcloud:playlists:432476748/sounds.rss

Expected Behavior

External track plays from YT music.

Actual Behavior

External resource shows a 403 error, followed by an info message stating that the audio outputs all 0’s due to CORS access restrictions. (This doesn’t happen in Chrome or Firefox), and I assume is due to a client side CORS restriction.

image

GET https://cf-media.sndcdn.com/Aebn75mGDwqR?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLW1lZGlhLnNuZGNkbi5jb20vQWVibjc1bUdEd3FSKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcwNDkwNjE3M319fV19&Signature=M3d7fvyrYxgQvG5sqDRdYSQMBjoqLr2eRcaikvnsP4U3njypIQKblosfnoGkDysOEFrt-cYfzVbPlxjzKhArZ5dGpRfzYqDI4O3hK2kQOl9611kLw8z7vvnuZ0viCebAm7pN4h2LLeWKDGo5agNfLxv0C3ytkcty4biqu8KiQU2~Eo5aDBYkWyVNXCP3PSjGciMC4LesfbcQiL~lUzfeKGOXD1Q0BN3nMSZG-Gkk8WSYM12vXtCjTip-~aNGPbLc4Okntvi~1H0JmDyIhyOPZRCDmuUopp3vVYfTZJ7mjxYcjJ9VAYg3v5EZQxd7UGTHp4ybjHBYRiL8mGf54SRSOg__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ 403 (Forbidden)
MediaElementAudioSource       /watch?v=OikBtHRKIRY&list=PLIxxqUUjNJMDW_5X-zjMxGBKbcS9p_08s:1 
outputs zeroes due to CORS access restrictions for https://www.podtrac.com/pts/redirect.mp3/feeds.soundcloud.com/stream/887295340-lemme-listen-the-ensigns-log-podcast-episode-066-just-a-little-empathy.mp3

Enabled plugins

  1. Discord Rich Presence
  2. Exponential Volume
  3. In-App Menu
  4. Navigation
  5. Shortcuts (& MPRIS)
  6. Video Toggle

Additional Information

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Just moved my Spotify library over to YT Music and found out about this app

Sadly also running into this issue with 3.6.0 😦


Edit: Just added this line into the index.ts file and ran it from the console using pnpm dev and it started playing the podcast without any issues https://github.com/electron/electron/issues/19775#issuecomment-834649057

(specifically after this line to have it neatly organized with the NODE_OPTIONS setting) https://github.com/th-ch/youtube-music/blob/0fcbe38837f37413429ed36878ab3f8207e4e9cc/src/index.ts#L75

I’ve also tried listening to other songs and so far I’ve not encountered any issues

Issue still present on v3.3.6 portable for me. Youtube made me move my podcast today since they are shutting down but Youtube Music app doesn’t work to play them. No issue on music.youtube website so doesn’t seem to be on their side.

Still not working in version 3.7.1.0. I am using portable and trying to listen to BBC podcast or any of the MSNBC ones. I don’t see where I can find the link to share within the app. Podcast added from within the app by “Add a podcast” then find the podcast I want will work fine. My podcasts were added “from a RSS feed” automatically by Google when I asked them to move my podcasts from the old Podcast app to youtube Music. I tried to find some of them on youtube music without much success.

Right now the msnbc ones refuse to even try to play. But BBC do and show these 2 errors in console: GET https://i1.ytimg.com/vi/QMGuBJJ0EQ0/mqdefault.jpg 404 (Not Found) watch?v=Bc7er_kdCuE:1 MediaElementAudioSource outputs zeroes due to CORS access restrictions for https://dl.iono.fm/epi/prov_4/epi_1516150_medium.m4a?p=rss

Both link change each different stream but the errors are the same.

In my synced-lyrics PR I had to fix CORS because the current fix was not working for me, maybe that also fixes this issue?

ArjixWasTaken/youtube-music@synced-lyrics/src/index.ts#L901-L916

betterSession.webRequest.onHeadersReceived((details, callback) => {
    details.responseHeaders ??= {};

    // prettier-ignore
    if (new URL(details.url).protocol === 'https:') {
      // Remove the content security policy
      delete details.responseHeaders['content-security-policy-report-only'];
      delete details.responseHeaders['content-security-policy'];

      // Only allow cross-origin requests from music.youtube.com
      delete details.responseHeaders['access-control-allow-origin'];
      details.responseHeaders['access-control-allow-origin'] = ['https://music.youtube.com'];
    }

    callback({ cancel: false, responseHeaders: details.responseHeaders });
  });

Tried with this code in the master branch, unfortunately still getting the same error and no audio

In my synced-lyrics PR I had to fix CORS because the current fix was not working for me, maybe that also fixes this issue?

https://github.com/ArjixWasTaken/youtube-music/blob/synced-lyrics/src/index.ts#L901-L916

betterSession.webRequest.onHeadersReceived((details, callback) => {
    details.responseHeaders ??= {};

    // prettier-ignore
    if (new URL(details.url).protocol === 'https:') {
      // Remove the content security policy
      delete details.responseHeaders['content-security-policy-report-only'];
      delete details.responseHeaders['content-security-policy'];

      // Only allow cross-origin requests from music.youtube.com
      delete details.responseHeaders['access-control-allow-origin'];
      details.responseHeaders['access-control-allow-origin'] = ['https://music.youtube.com'];
    }

    callback({ cancel: false, responseHeaders: details.responseHeaders });
  });

same Issue on v3.3.12

Would be great if we could listen to podcasts in the app now that Google Podcasts is folding into YTM. On macOS in this app, podcasts visually appear to be playing (the time/duration advances each second, play icon switches to pause) but no audio is heard.