Skip to content

Commit

Permalink
Merge pull request #4 from cprn/master
Browse files Browse the repository at this point in the history
fixed oauth in `mopidy ytmusic setup` command
  • Loading branch information
jmcdo29 authored Jan 10, 2024
2 parents e29097a + 445ecd8 commit d5e1f56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions mopidy_ytmusic/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down

0 comments on commit d5e1f56

Please sign in to comment.