From 6509b58c9bfd8f9f2f09f4f8eba7da0bdcaf8329 Mon Sep 17 00:00:00 2001 From: cprn Date: Sun, 31 Dec 2023 11:45:44 +0100 Subject: [PATCH 1/2] fixed oauth in `mopidy ytmusic setup` command Also removed the upper boundary of pytube version because it collides with 15.0.0 and there are no changes preventing the current code from working. --- mopidy_ytmusic/command.py | 15 ++++----------- setup.py | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/mopidy_ytmusic/command.py b/mopidy_ytmusic/command.py index 757c37a..7a0e33c 100644 --- a/mopidy_ytmusic/command.py +++ b/mopidy_ytmusic/command.py @@ -17,27 +17,20 @@ class SetupCommand(commands.Command): help = "Generate auth.json" def run(self, args, config): - from ytmusicapi import YTMusic + from ytmusicapi.setup import setup_oauth filepath = input( "Enter the path where you want to save auth.json [default=current dir]: " ) if not filepath: filepath = os.getcwd() - path = Path(filepath + "/auth.json") + path = Path(filepath + "/oauth.json") print('Using "' + str(path) + '"') if path.exists(): print("File already exists!") return 1 - print( - "Open Youtube Music, open developer tools (F12), go to Network tab," - ) - print( - 'right click on a POST request and choose "Copy request headers".' - ) - print("Then paste (CTRL+SHIFT+V) them here and press CTRL+D.") try: - print(YTMusic(filepath=str(path))) + setup_oauth(filepath=str(path)) except Exception: logger.exception("YTMusic setup failed") return 1 @@ -54,7 +47,7 @@ class ReSetupCommand(commands.Command): help = "Regenerate auth.json" def run(self, args, config): - from ytmusicapi import YTMusic + from ytmusicapi.setup import setup_oauth path = config["ytmusic"]["auth_json"] usingOauth = False diff --git a/setup.py b/setup.py index 4dce818..2c75924 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ install_requires = [ "Mopidy>=3,<4", - "pytube>=12.1.0,<13.0.0", + "pytube>=12.1.0", "ytmusicapi>=0.22.0,<2.0.0", ] From 445ecd85ef4806cee4077fe415ca9d3c71e0ec10 Mon Sep 17 00:00:00 2001 From: cprn Date: Sun, 31 Dec 2023 11:59:52 +0100 Subject: [PATCH 2/2] reverting one overzealous change --- mopidy_ytmusic/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mopidy_ytmusic/command.py b/mopidy_ytmusic/command.py index 7a0e33c..e767cd5 100644 --- a/mopidy_ytmusic/command.py +++ b/mopidy_ytmusic/command.py @@ -47,7 +47,7 @@ class ReSetupCommand(commands.Command): help = "Regenerate auth.json" def run(self, args, config): - from ytmusicapi.setup import setup_oauth + from ytmusicapi import YTMusic path = config["ytmusic"]["auth_json"] usingOauth = False