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

Cannot browse Youtube within Mopidy library #246

Open
mgoltzsche opened this issue Sep 2, 2023 · 5 comments
Open

Cannot browse Youtube within Mopidy library #246

mgoltzsche opened this issue Sep 2, 2023 · 5 comments

Comments

@mgoltzsche
Copy link

mgoltzsche commented Sep 2, 2023

When I browse Youtube in the Mopidy library, the two available directories "My Youtube artists" and "My Youtube playlists" are empty and errors are logged.

Browsing "My Youtube artists" fails with the following errors being logged:

ERROR    2023-09-02 21:40:09,471 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Channel.playlists list_channelplaylists error "Server returned HTTP 400: Bad Request.
Request contains an invalid argument."
ERROR    2023-09-02 21:40:09,471 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Cannot load youtube:channel:artists
ERROR    2023-09-02 21:40:09,630 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Channel.playlists list_channelplaylists error "'playlists'"
ERROR    2023-09-02 21:40:09,631 [31:Core-11 (_actor_loop)] mopidy.core.library
  YouTubeBackend backend caused an exception.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/mopidy/core/library.py", line 17, in _backend_error_handling
    yield
  File "/usr/lib/python3.10/site-packages/mopidy/core/library.py", line 114, in _browse
    result = backend.library.browse(uri).get()
  File "/usr/lib/python3.10/site-packages/pykka/_threading.py", line 55, in get
    raise exc_value
  File "/usr/lib/python3.10/site-packages/pykka/_actor.py", line 186, in _actor_loop
    response = self._handle_receive(envelope.message)
  File "/usr/lib/python3.10/site-packages/pykka/_actor.py", line 286, in _handle_receive
    return callee(*message.args, **message.kwargs)
  File "/usr/lib/python3.10/site-packages/cachetools/__init__.py", line 737, in wrapper
    v = func(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/mopidy_youtube/backend.py", line 195, in browse
    playlists = [
TypeError: 'NoneType' object is not iterable

Browsing "My Youtube playlists" fails with the following error being logged:

ERROR    2023-09-02 21:41:54,304 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Cannot load youtube:browse
ERROR    2023-09-02 21:41:54,306 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Cannot load youtube:browse
ERROR    2023-09-02 21:41:56,632 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Channel.playlists list_channelplaylists error "'playlists'"
ERROR    2023-09-02 21:41:56,632 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Cannot load youtube:channel:root

I enabled musicapi_enabled, configured my channel_id and the musicapi_cookiefile as well as youtube_api_key for which I also enabled api_enabled.

I am using

  • mopidy-youtube 3.7
  • ytmusicapi 1.2.1

I would expect to see artists and playlists and no errors being logged.
Am I using mopidy-youtube the wrong way? Does it work for you?

This is not really a blocker since the Mopidy search works with Youtube but it would be nice to have that fixed - ideally I'd want to browse tracks I liked on Youtube.

(As opposed to the other issue I just created, this is not a new problem that appeared after a recent Youtube change but always existed in my setup.)

@mgoltzsche
Copy link
Author

mgoltzsche commented Sep 2, 2023

Also, the mopidy-youtube readme explains that musicapi_browser_authentication_file should be configured to make the ytmusicapi authenticate properly but apparently mopidy-youtube does not support such a configuration key. I guess it generates the browser.json for the ytmusicapi from a given cookies.txt file?

@mgoltzsche
Copy link
Author

mgoltzsche commented Sep 2, 2023

I thought maybe the ytmusicapi version I used is too new since there was a breaking change in its version 0.23.0.
Thus, I tried using version 0.22.0 (and 0.23.0) which logged a slightly different error when trying to browse "My Youtube playlists" but resulted in the same broken behaviour otherwise:

ERROR    2023-09-02 21:53:23,140 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Channel.playlists list_channelplaylists error "Server returned HTTP 500: Internal Server Error.
Internal error encountered."
ERROR    2023-09-02 21:53:23,140 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Cannot load youtube:channel:root
ERROR    2023-09-02 21:53:23,775 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Channel.playlists list_channelplaylists error "Server returned HTTP 500: Internal Server Error.
Internal error encountered."
ERROR    2023-09-02 21:53:23,776 [31:YouTubeBackend-3 (_actor_loop)] mopidy_youtube
  Cannot load youtube:channel:root

@mgoltzsche mgoltzsche changed the title Cannot browse Youtube resources (other than searching tracks) Cannot browse Youtube within Mopidy library (other than searching tracks) Sep 2, 2023
@mgoltzsche mgoltzsche changed the title Cannot browse Youtube within Mopidy library (other than searching tracks) Cannot browse Youtube within Mopidy library Sep 2, 2023
@daredoes
Copy link

daredoes commented Sep 3, 2023

@mgoltzsche Just ran into this myself. It's because 3.7 was released in May but the fix was merged in July. Put this in your requriements.txt file instead, and make sure to uninstall the existing version, if any, first.

git+https://github.com/natumbri/mopidy-youtube.git@develop#egg=Mopidy-YouTube

@daredoes
Copy link

daredoes commented Sep 3, 2023

@mgoltzsche also musicapi_cookie is now musicapi_cookiefile and it looks like the musicapi_browser_authentication_file doesn't support using env vars

@mgoltzsche
Copy link
Author

mgoltzsche commented Sep 3, 2023

@daredoes Thanks for pointing that out! Unfortunately, when using the latest commit on the develop branch and letting musicapi_browser_authentication_file point to a browser.json file (generated using ytmusicapi) it also doesn't list Youtube contents within the Mopidy library but logs the same error: Server returned HTTP 500: Internal Server Error.
Does it work for you? Maybe this time the error is also due to the last breaking Youtube change, given that I fixed my configuration and used the latest commit? Or is the feature still in the making?

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