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

Trying to add a playlist #77

Closed
lecler-i opened this issue Apr 13, 2017 · 2 comments
Closed

Trying to add a playlist #77

lecler-i opened this issue Apr 13, 2017 · 2 comments

Comments

@lecler-i
Copy link

Got an exception while trying to add a youtube playlist

Playlist : https://www.youtube.com/playlist?list=LLdUp_BzeBZx6GKJpALjBooQ
Command : add "yt:https://www.youtube.com/playlist\?list\=LLdUp_BzeBZx6GKJpALjBooQ"

Log :

DEBUG    2017-04-14 03:10:36,387 [9923:MpdSession-15] mopidy.mpd.session
  Request from [::ffff:127.0.0.1]:33504: add "yt:https://www.youtube.com/playlist?list=LLdUp_BzeBZx6GKJpALjBooQ"
INFO     2017-04-14 03:10:36,392 [9923:YouTubeBackend-7] mopidy_youtube
  Resolving YouTube-Playlist 'LLdUp_BzeBZx6GKJpALjBooQ'
ERROR    2017-04-14 03:10:36,595 [9923:Core-9] mopidy.core.library
  YouTubeBackend backend caused an exception.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/mopidy/core/library.py", line 19, in _backend_error_handling
    yield
  File "/usr/lib/python2.7/site-packages/mopidy/core/library.py", line 236, in lookup
    result = future.get()
  File "/usr/lib/python2.7/site-packages/pykka/future.py", line 299, in get
    exec('raise exc_info[0], exc_info[1], exc_info[2]')
  File "/usr/lib/python2.7/site-packages/pykka/actor.py", line 200, in _actor_loop
    response = self._handle_receive(message)
  File "/usr/lib/python2.7/site-packages/pykka/actor.py", line 294, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/usr/lib/python2.7/site-packages/mopidy_youtube/backend.py", line 158, in lookup
    return resolve_playlist(req.get('list')[0])
  File "/usr/lib/python2.7/site-packages/mopidy_youtube/backend.py", line 130, in resolve_playlist
    for item in data["items"]:
KeyError: u'items'
DEBUG    2017-04-14 03:10:36,613 [9923:MpdSession-15] mopidy.mpd.session
  Response to [::ffff:127.0.0.1]:33504: ACK [50@0] {add} directory or file not found
DEBUG    2017-04-14 03:10:36,613 [9923:MpdSession-15] mopidy.mpd.session
  Request from [::ffff:127.0.0.1]:33504: load "yt:https://www.youtube.com/playlist?list=LLdUp_BzeBZx6GKJpALjBooQ"
DEBUG    2017-04-14 03:10:36,625 [9923:MpdSession-15] mopidy.mpd.session
  Response to [::ffff:127.0.0.1]:33504: ACK [50@0] {load} No such playlist
DEBUG    2017-04-14 03:10:36,626 [9923:MpdSession-15] mopidy.mpd.session
  Request from [::ffff:127.0.0.1]:33504: idle
@LegendEffects
Copy link

I am having the same error after trying to add another playlist. I have successfully added the same one before.

INFO     Resolving YouTube-Playlist 'UU3ifTl5zKiCAhHIBQYcaTeg'
ERROR    YouTubeBackend backend caused an exception.
Traceback (most recent call last):
  File "/home/pi/.local/lib/python2.7/site-packages/mopidy/core/library.py", line 19, in _backend_error_handling
    yield
  File "/home/pi/.local/lib/python2.7/site-packages/mopidy/core/library.py", line 236, in lookup
    result = future.get()
  File "/home/pi/.local/lib/python2.7/site-packages/pykka/threading.py", line 52, in get
    compat.reraise(*self._data['exc_info'])
  File "/home/pi/.local/lib/python2.7/site-packages/pykka/compat.py", line 12, in reraise
    exec('raise tp, value, tb')
  File "/home/pi/.local/lib/python2.7/site-packages/pykka/actor.py", line 201, in _actor_loop
    response = self._handle_receive(message)
  File "/home/pi/.local/lib/python2.7/site-packages/pykka/actor.py", line 295, in _handle_receive
    return callee(*message['args'], **message['kwargs'])
  File "/home/pi/.local/lib/python2.7/site-packages/mopidy_youtube/backend.py", line 158, in lookup
    return resolve_playlist(req.get('list')[0])
  File "/home/pi/.local/lib/python2.7/site-packages/mopidy_youtube/backend.py", line 130, in resolve_playlist
    for item in data["items"]:
KeyError: u'items'

@spy1134
Copy link

spy1134 commented May 29, 2018

I added a call to print the entirety of the object "data" right before the line that throws the error.
Here is what may be going on:
{u'error': {u'code': 403, u'message': u'Access Not Configured. YouTube Data API has not been used in project 119103001349 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=119103001349 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.', u'errors': [{u'domain': u'usageLimits', u'message': u'Access Not Configured. YouTube Data API has not been used in project 119103001349 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=119103001349 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.', u'reason': u'accessNotConfigured', u'extendedHelp': u'https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=119103001349'}]}}

EDIT: Confirmed that the issue is the API key. I generated one for my own use and swapped it into backend.py located at /usr/local/lib/python2.7/dist-packages/mopidy_youtube/backend.py

EDIT 2: Apparently Mopidy-YouTube may violate the YouTube API terms of service. #92
I would recommend using extreme caution with generating your own API key as it appears that Google may suspend accounts that violate the API terms of use.

I deleted my own API key to err on the safe side.

See here for more details: https://developers.google.com/youtube/terms/developer-policies#h-monitoring-and-audits
Specifically, see section "I. Additional Prohibitions", subsection 6 "modify, build upon, or block any portion or functionality of a YouTube player;" subsection 7 "separate, isolate, or modify the audio or video components of any YouTube audiovisual content made available as part of, or in connection with, YouTube API Services. For example, you must not apply alternate audio tracks to videos;", and subsection 9 "create, include, or promote features that play content, including audio or video components, from a background player, meaning a player that is not displayed in the page, tab, or screen that the user is viewing;"

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

Successfully merging a pull request may close this issue.

3 participants