sigma67 / spotify_to_ytmusic

Clone a Spotify playlist to YouTube Music
MIT License
790 stars 65 forks source link

support spotify headless oauth #71

Closed ahxxm closed 8 months ago

sigma67 commented 9 months ago

Honestly I'd prefer to detect this situation and act accordingly instead of introducing some environment variable.

What issues are you having in WSL? If they are valid, can't we just detect WSL?

ahxxm commented 9 months ago

sorry I forgot to update the description, it could be WSL(detectable through environment variables I think? not familiar with what Microsoft guarantees) or another headless environment like a server(I've no clue how to detect)

for now, the library spotipy doesn't open a browser, it silently skips this step and directly asks for the redirect URL as if I've authorized with that tab

after the change the library will give me a link for authorization

sigma67 commented 9 months ago

How about sys.stdin.isatty()? Does that detect your environment?

ahxxm commented 9 months ago

it returns True on my VPS, does it return False for you or when the library can open a new browser tab?

sigma67 commented 8 months ago

Hi man, sorry to close this, but there's a better way: https://stackoverflow.com/a/39371956/5726546

I'll add it and hope it solves your problem as well :)