Closed windowswithoutborders closed 1 year ago
@windowswithoutborders excellent work outlining the steps required, it will help future users to properly get mpsyt up and running.I do wonder why the devs have a lack of interest in updating this project with the necessary fixes.
even after all of this i still end up with Command-line option --title: option requires parameters lol
@archtheseus
Ah, sorry to hear that. Not that I have any solution, but for troubleshooting purposes could you post the output of mpv --version
and pip3 show youtube-dl
/pipx list --include-injected
?
For me on macOS with pipx:
> mpv --version
mpv 0.33.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
built on Mon Nov 23 23:02:08 CET 2020
FFmpeg library versions:
libavutil 56.51.100
libavcodec 58.91.100
libavformat 58.45.100
libswscale 5.7.100
libavfilter 7.85.100
libswresample 3.7.100
FFmpeg version: 4.3.1
> pipx list --include-injected
venvs are in /Users/aoede/.local/pipx/venvs
apps are exposed on your $PATH at /Users/aoede/.local/bin
package mps-youtube 0.2.8, Python 3.9.1
- mpsyt
Injected Packages:
- pyperclip 1.8.1
- youtube-dl 2021.2.4.1
even after all of this i still end up with Command-line option --title: option requires parameters lol
I had the same issue when installing the stable branch. When I switched to the development branch, this issue was fixed for me (I just installed the development branch, didn't explicitly remove the stable branch).
Is it possible to use it without an API? I have no problem playing audio or video with Mpv and I have not set any API whatsoever with it.
even after all of this i still end up with Command-line option --title: option requires parameters lol
I had the same issue when installing the stable branch. When I switched to the development branch, this issue was fixed for me (I just installed the development branch, didn't explicitly remove the stable branch).
Can confirm that switching to dev fixed this one. Thanks!
I followed and i get this error
Traceback (most recent call last):
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/pafy/util.py", line 34, in call_gdata
data = g.opener.open(url).read().decode('utf-8')
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 523, in open
response = meth(req, response)
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 632, in http_response
response = self.parent.error(
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 561, in error
return self._call_chain(*args)
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/mpsyt", line 33, in <module>
sys.exit(load_entry_point('mps-youtube==0.2.8', 'console_scripts', 'mpsyt')())
File "/usr/local/bin/mpsyt", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/mps_youtube/__init__.py", line 8, in <module>
init.init()
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/mps_youtube/init.py", line 58, in init
cache.load()
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/mps_youtube/cache.py", line 34, in load
pafy.load_cache(cached['pafy'])
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/pafy/pafy.py", line 184, in load_cache
set_categories(newcache.get('categories', {}))
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/pafy/pafy.py", line 171, in set_categories
catinfo = call_gdata('videoCategories', query)
File "/usr/local/Cellar/mps-youtube/0.2.8_11/libexec/lib/python3.9/site-packages/pafy/util.py", line 42, in call_gdata
raise GdataError(errmsg)
pafy.util.GdataError: Youtube Error 403: The request cannot be completed because you have exceeded your <a href="/youtube/v3/getting-started#quota">quota</a>.
I've been using mps-youtube for a couple weeks now and absolutely love it. Unfortunately, it's not as simple as installing it to get it up and running. But through the work of some skilled and helpful people on here, I'd like to share the additional steps that have been discovered that should get mps-youtube working again. I hope this can benefit those just coming across this project and understanding the appeal of a program like this. Note, these steps resulted in a perfectly usable mps-youtube on arch and macos. And of course, all of this assumes you have a player installed. I use mpv and will mention certain issues specific to mpv.
Anyways, let's start with installation:
Installing
or
I say get the development branch. I'm sure there are some other differences, but I noticed the development branch added tab complete to the set parameters you'll choose within mpsyt, which is actually pretty nice. I haven't noticed any bugs in the branch either so it seems perfectly usable.
Be sure to get the dependencies as well. Although I already had youtube-dl installed through my package manager, mps-youtube wouldn't work until I got it from pip. If you do have youtube-dl on your system through a package manager, potential conflicts between the two packages won't be an issue as the
--user
install flag ensures that it is only installed locally to your user. That is to say, should you invoke youtube-dl on your command line, your path variable should choose the youtube-dl bin from the package manager over the one installed from pip.You can upgrade these packages with
$ pip3 install --user <package-name> --upgrade
OPTIONAL: Installing with pipx
It doesn't really matter, but I prefer to use pipx for installing packages from pip just to isolate them that much further from packages installed from my package manager. Pipx will install packages into their own isolated virtual environments. I especially like doing this on macOS because pipx will install packages into ~/.local, which is where I would expect
pip install --user
to place them, but on mac they go into ~/Library/Python instead.You can upgrade with
$ pipx upgrade-all --include-injected ### upgrade everything installed through pipx
Create a youtube api key
Despite the installation being complete, don't bother with a first run of
mpsyt
, you're going to want to create a youtube api key to use with mpsyt first. This is discussed at length in this thread https://github.com/mps-youtube/mps-youtube/issues/1063. It's reiterated multiple ways in the thread, but this specific comment https://github.com/mps-youtube/mps-youtube/issues/1063#issuecomment-591440175 quickly goes over the steps required for creating an api key:I wouldn't bother with a first launch yet to set your api key, because if you're using mpv, you're probably going to experience playback issues anyways.
Fixing MPV issues
So this issue has been discussed here https://github.com/mps-youtube/mps-youtube/issues/1134#issuecomment-753319665 and here https://github.com/mps-youtube/mps-youtube/issues/1128#issuecomment-744042068. Apparently the solution detailed in #1134 works, but I needed to follow the steps in #1128 to get it to work for me. The steps are self-explanatory, so try either method. The one thing to note is the location of these files. Use the following commands to find where mps-youtube is located on your system:
You'll ultimately end up in the ../site-packages/mps_youtube directory
Let's go over the steps in #1128 for fixing mpv playback. You'll have to add a line of code to two files.
The code:
if 'data' in resp:
The files:
../site-packages/mps_youtube/mpris.py
and../site-packages/mps_youtube/player.py
(STABLE BRANCH) OR../site-packages/mps_youtube/players/mpv.py
(DEV BRANCH)the code to edit comes after the comment in both files: "# deals with bug in mpv 0.7 - 0.7.3". Search this line in your editor and you should be able to easily spot where you need to add the code from there. The code must look like this:
mpris.py
player.py OR player/mpv.py
With all of that out of the way, we can go onto configuring mps-youtube.
First launch and configuration
Run
mpsyt
and type in set. You'll see a list of parameters you can specify. The most important beingapi_key
. Get the youtube api key you created and pass it into mpsyt. Additionally, you can set these extra parameters as well:With all that being done, type
q
to quit, navigate to ~/.config/mps-youtube and delete the cache file inside. Relaunch mpsyt and play your first video. I hope it worked!Closing
Thank you to the author of this program, all contributors, and everyone who left a comment addressing the issues that have popped up. Stuff like that is why I love the open-source community. This is a great project and with some tweaking here and there it's still perfectly usable. I hope this will benefit you and your workflow the way it has for me. Be sure to look into the set parameters and dialing them into what works best for you, for instance I have some arguments set for playerargs. Also, look into the help section, especially
help basic
help search
help invoke
help config
andhelp tips
. Enjoy mps-youtube :).TLDR
KeyError: data
when trying to play video??)Troubleshooting