home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.54k stars 29.46k forks source link

Soundcloud links not working in media_extractor integration #116892

Open lwsrbrts opened 3 months ago

lwsrbrts commented 3 months ago

The problem

When attempting to either play or extract the URL of Soundcloud links, the result is not usable or doesn't play.

I have supplied the same URL to the standalone binary version of yt-dlp which works and downloads a file from the Soundcloud link.

The binary version I'm using is 2024.04.09 which is the same as the version defined in the integration's manifest.json file:

"requirements": ["yt-dlp==2024.04.09"]

What version of Home Assistant Core has the issue?

core-2024.5.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Media Extractor

Link to integration documentation on our website

https://www.home-assistant.io/integrations/media_extractor

Diagnostics information

No response

Example YAML snippet

service: media_extractor.extract_media_url
data:
  url: https://soundcloud.com/bruttoband/brutto-11
  format_query: best

Technically the above works in so far as it gives a URL but the URL itself isn't usable to, say, pass to the Media Player integration.

or

service: media_extractor.play_media
data:
  media_content_id: https://soundcloud.com/bruttoband/brutto-11
target:
  entity_id: media_player.office_tv

The above simply results in a timeout in the logs for the Media Player.

Anything in the logs that might be useful for us?

No response

Additional information

The logs reflect only that the media player could not play the link but the same link is returned by the extract_media_url link.

YouTube links work as expected.

home-assistant[bot] commented 3 months ago

Hey there @joostlek, mind taking a look at this issue as it has been labeled with an integration (media_extractor) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `media_extractor` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign media_extractor` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


media_extractor documentation media_extractor source (message by IssueLinks)

issue-triage-workflows[bot] commented 2 weeks ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

lwsrbrts commented 2 weeks ago

I do still see this in the latest version of HA 2024.7.3 and using the current beta 2024.8.01 which uses yt-dlp 2024.8.1. Again, manual downloading with yt-dlp binary works fine.

I can use the URL manually in VLC player so that is working...seemingly what's not working is playing the media to a Chromecast device.

Logger: homeassistant.core
Source: core.py:2751
First occurred: 23:21:21 (1 occurrences)
Last logged: 23:21:21

Error executing service: <ServiceCall media_player.play_media (c:01J4D59M5G4T6167M8CT7ZNWGD): extra=, entity_id=['media_player.office_home'], media_type=MUSIC, media_id=https://cf-hls-opus-media.sndcdn.com/playlist/50remGX1OqRY.64.opus/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1vcHVzLW1lZGlhLnNuZGNkbi5jb20vcGxheWxpc3QvNTByZW1HWDFPcVJZLjY0Lm9wdXMvcGxheWxpc3QubTN1OCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3MjI3MjQwMDB9fX1dfQ__&Signature=OV8lMqMboYNkn7oNaAKbwLK7vNIik9VR3L68dWa5evxdPdzDwwlid~AeZqEKv5DaniMjRB4tofMqHKdxn~77n5zi3K~jN6xsu2S3xrpbgkkc9oKWetI0~QW09X2NjyJtcbb01P0I6HjAuzBMre16ck8axqWvZFbwHMnHd3xzbc89ixGHsGCk9pBSWetUMnHxihCqCFitABrtmPvgN5BvtfCuLi1-aGo5Et~-dsKqLWBZaspQSJrXcw~n7cs-fBAy-OMIhOPjO2QFZM5BFCaW8FY7YPIHw40zh1wCbgJWnl67Rswck0soHJSHGaSMhym8O2q4z6FUp49hMheWTlmUYw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 100, in wrapper
    return_value = func(self, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 508, in _quick_play
    quick_play(self._get_chromecast(), app_name, data)
  File "/usr/local/lib/python3.12/site-packages/pychromecast/quick_play.py", line 97, in quick_play
    controller.quick_play(**data, timeout=timeout)
  File "/usr/local/lib/python3.12/site-packages/pychromecast/controllers/media.py", line 559, in quick_play
    response_handler.wait_response()
  File "/usr/local/lib/python3.12/site-packages/pychromecast/response_handler.py", line 54, in wait_response
    raise RequestTimeout(self._request, self._timeout)
pychromecast.error.RequestTimeout: Execution of quick play https://cf-hls-opus-media.sndcdn.com/playlist/50remGX1OqRY.64.opus/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1vcHVzLW1lZGlhLnNuZGNkbi5jb20vcGxheWxpc3QvNTByZW1HWDFPcVJZLjY0Lm9wdXMvcGxheWxpc3QubTN1OCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3MjI3MjQwMDB9fX1dfQ__&Signature=OV8lMqMboYNkn7oNaAKbwLK7vNIik9VR3L68dWa5evxdPdzDwwlid~AeZqEKv5DaniMjRB4tofMqHKdxn~77n5zi3K~jN6xsu2S3xrpbgkkc9oKWetI0~QW09X2NjyJtcbb01P0I6HjAuzBMre16ck8axqWvZFbwHMnHd3xzbc89ixGHsGCk9pBSWetUMnHxihCqCFitABrtmPvgN5BvtfCuLi1-aGo5Et~-dsKqLWBZaspQSJrXcw~n7cs-fBAy-OMIhOPjO2QFZM5BFCaW8FY7YPIHw40zh1wCbgJWnl67Rswck0soHJSHGaSMhym8O2q4z6FUp49hMheWTlmUYw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ timed out after 30.0 s.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 2751, in _run_service_call_catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 777, in async_play_media
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 102, in wrapper
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: CastMediaPlayerEntity._quick_play Failed: Execution of quick play https://cf-hls-opus-media.sndcdn.com/playlist/50remGX1OqRY.64.opus/playlist.m3u8?Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiKjovL2NmLWhscy1vcHVzLW1lZGlhLnNuZGNkbi5jb20vcGxheWxpc3QvNTByZW1HWDFPcVJZLjY0Lm9wdXMvcGxheWxpc3QubTN1OCoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3MjI3MjQwMDB9fX1dfQ__&Signature=OV8lMqMboYNkn7oNaAKbwLK7vNIik9VR3L68dWa5evxdPdzDwwlid~AeZqEKv5DaniMjRB4tofMqHKdxn~77n5zi3K~jN6xsu2S3xrpbgkkc9oKWetI0~QW09X2NjyJtcbb01P0I6HjAuzBMre16ck8axqWvZFbwHMnHd3xzbc89ixGHsGCk9pBSWetUMnHxihCqCFitABrtmPvgN5BvtfCuLi1-aGo5Et~-dsKqLWBZaspQSJrXcw~n7cs-fBAy-OMIhOPjO2QFZM5BFCaW8FY7YPIHw40zh1wCbgJWnl67Rswck0soHJSHGaSMhym8O2q4z6FUp49hMheWTlmUYw__&Key-Pair-Id=APKAI6TU7MMXM5DG6EPQ timed out after 30.0 s.