natumbri / mopidy-youtube

Mopidy extension for playing music from YouTube
Apache License 2.0
257 stars 75 forks source link

Mopidy Youtube #144

Closed NathanealV closed 4 years ago

NathanealV commented 4 years ago

My error code is below. I am having trouble playing Youtube videos as it says This video is unavailable. However if I go into my browser on my PC it is not region restricted or anything. Youtube-Dl is the latest version.

May 04 10:37:20 raspberrypi mopidy[18681]: INFO     [YouTubeBackend-3] mopidy_youtube Searching YouTube for query "mkbhd"
May 04 10:37:20 raspberrypi mopidy[18681]: INFO     [YouTubeBackend-3] mopidy_youtube session.get triggered: search
May 04 10:37:22 raspberrypi mopidy[18681]: INFO     [YouTubeBackend-3] mopidy_youtube youtube LibraryProvider.search "{'album': ['mkbhd']}"
May 04 10:37:22 raspberrypi mopidy[18681]: INFO     [YouTubeBackend-3] mopidy_youtube youtube LibraryProvider.search "{'artist': ['mkbhd']}"
May 04 10:37:30 raspberrypi mopidy[18681]: INFO     [YouTubeBackend-3] mopidy_youtube youtube LibraryProvider.lookup "youtube:video/iPhone 11 Pro Review 6 Months Later.nxf41fMX_Y4"
May 04 10:37:30 raspberrypi mopidy[18681]: [youtube] nxf41fMX_Y4: Downloading webpage
May 04 10:37:30 raspberrypi mopidy[18681]: INFO     [YouTubeBackend-3] mopidy_youtube youtube PlaybackProvider.translate_uri "youtube:video/iPhone 11 Pro Review 6 Months Later.nxf41fMX_Y4"
May 04 10:37:31 raspberrypi mopidy[18681]: [youtube] nxf41fMX_Y4: Downloading video info webpage
May 04 10:37:34 raspberrypi mopidy[18681]: ERROR: nxf41fMX_Y4: YouTube said: This video is unavailable.
May 04 10:37:34 raspberrypi mopidy[18681]: ERROR    [Thread-12] mopidy_youtube audio_url error "ERROR: nxf41fMX_Y4: YouTube said: This video is unavailable."
May 04 10:37:34 raspberrypi mopidy[18681]: WARNING  [Core-7] mopidy.core.tracklist Track is not playable: youtube:video/iPhone 11 Pro Review 6 Months Later.nxf41fMX_Y4

Edit: I have tried different backends but still the same problem. I have tried both with api enabled and disabled and still nothing. My configuration is below:

enabled = true
youtube_api_key = xxxxxxxxxxxxxxx
threads_max = 16
search_results = 15
playlist_max_videos = 20
api_enabled = false
natumbri commented 4 years ago

@NathanealV thanks for the report - that's really strange. When I play "youtube:video/iPhone 11 Pro Review 6 Months Later.nxf41fMX_Y4" as a stream in the musicbox webclient, it just plays. It also plays when I find it using a search.

Does this happen for you on more than one track?

ghost commented 4 years ago

Same problem. Do you gonna fix it?

natumbri commented 4 years ago

@artamudo I think you mean 'same symptoms' - once we can work out the problem that is causing them, absolutely I'm gonna fix it.

Can you tell me a bit more about your experience? Does the extension ever work? Can you give examples of tracks that do play and ones that don't play? Does it happen immediately after you start mopidy or does it take some time before it starts happening? Do tracks that fail always fail or only sometimes?

The extension works for me - to fix the problem, I need to reproduce the symptoms you are experiencing, which means I need to understand when the occur. That can only happen with your help.

NathanealV commented 4 years ago

@NathanealV thanks for the report - that's really strange. When I play "youtube:video/iPhone 11 Pro Review 6 Months Later.nxf41fMX_Y4" as a stream in the musicbox webclient, it just plays. It also plays when I find it using a search.

Does this happen for you on more than one track?

Yes it happens for any track.

@artamudo I think you mean 'same symptoms' - once we can work out the problem that is causing them, absolutely I'm gonna fix it.

Can you tell me a bit more about your experience? Does the extension ever work? Can you give examples of tracks that do play and ones that don't play? Does it happen immediately after you start mopidy or does it take some time before it starts happening? Do tracks that fail always fail or only sometimes?

The extension works for me - to fix the problem, I need to reproduce the symptoms you are experiencing, which means I need to understand when the occur. That can only happen with your help.

I just set up Mopidy on my Raspberry Pi 3B. I first installed Mopidy, then Mopidy-Youtube, then upmpdcli. I am using Iris as my front end but I have also tried using MusicBox but the same thing happens. Since it is my first time, I have not used it in the past and so I don't know if it has every worked. I have tried restarting mopidy as well but it doesn't fix anything.

NathanealV commented 4 years ago

It seems that I have resolved the issue. There were conflicting packages with youtube-dl (the apt and the pip package). I uninstalled the apt package as it was last updated in 2019 and just had the pip package. I reconfigured everything for Mopidy and it seems to be working flawlessly. Thanks!

If I can ask, what's the difference with and without the Api?

kingosticks commented 4 years ago

Can you specify a minimum required version of youtubedl to avoid this?

natumbri commented 4 years ago

@kingosticks absolutely I can do that! Not having the most recent (or even a fairly recent) version of youtube-dl is a common cause of difficulties; I probably should have thought of this earlier.

Have you got any suggestions about which version I should pick, or how I should make that decision? My instinct is to just set it to the current version and update it each time I release a new version of the extension.

kingosticks commented 4 years ago

You could try to gauge how they manage their releases (e.g. rarely and very stable or more frequently) and maybe have a chat to their developers about it? Ultimately since this is all coming from pip, rather than APT, and the latest version will always be available to everyone, your instinct sounds fine to me.

natumbri commented 4 years ago

They release new versions very frequently - sometimes a couple of weeks apart. Google (et al) make breaking changes and introduce new features (etc) pretty often; the youtube-dl crew react pretty quickly. And good point re pip - I'm going with the current version. Cheers.

trygveaa commented 4 years ago

Ultimately since this is all coming from pip, rather than APT

youtube-dl is packaged in Debian and other distros, so it may come from apt or other package managers, and thus not be the latest released version.

The best would be to specify the earliest version that's working.

kingosticks commented 4 years ago

But in this case, Mopidy-Youtube always comes from pip, so it can specify a requirement which, if not met by APT etc, will always be downloaded. I guess the bit I'm not 100% sure about is that if there's an old version from APT and a new version from pip both installed and the program specifies a dependency on the new version, will the newer version always be actually used?

natumbri commented 4 years ago

Yeah, I'm not sure how that conflict sorts itself out. The issue is that the older the youtube-dl version, the more likely that it will cause a difficult-to-track-down problem playing particular clips.

"I can't install the extension because my distribution packages an old version of youtube-dl" is a much easier problem to solve than "I installed the extension but it won't play my favorite clip"...

kingosticks commented 4 years ago

I think the problem is that it'll install OK but if the old APT version that happens to be on your system takes preference over the new pip version when you come to run it, then you are still left scratching your head as to why it's not working (until the user actually provides the output of sudo mopidyctl deps and it becomes clear).

trygveaa commented 4 years ago

But in this case, Mopidy-Youtube always comes from pip, so it can specify a requirement which, if not met by APT etc, will always be downloaded.

That's not necessarily true. Mopidy-Youtube is packaged in AUR for instance. Or one could create a deb package for it oneself.

I guess the bit I'm not 100% sure about is that if there's an old version from APT and a new version from pip both installed and the program specifies a dependency on the new version, will the newer version always be actually used?

I'm not sure, it probably depends on where the package manager installs the packages etc. Given that OP had an issue with this, the newer version is probably not always used though.

Yeah, I'm not sure how that conflict sorts itself out. The issue is that the older the youtube-dl version, the more likely that it will cause a difficult-to-track-down problem playing particular clips.

Then maybe you should add a runtime requirement on the required version. I don't think this should be naively set to the latest version though, as that might be impractical for the users.

natumbri commented 4 years ago

Thanks all - those are good points; I'll do a bit more research, and try to make a decision that doesn't create new problems for too many people!