[GH-ISSUE #134] Unable to connect on WSL #97

Closed
opened 2026-02-27 22:08:00 +03:00 by kerem · 3 comments
Owner

Originally created by @LewisGaul on GitHub (Dec 28, 2020).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/134

Just wanted to point out, in case it's helpful, that it seems that it's not possible to connect from Windows Subsystem for Linux (version 1 at least) when the request headers have been obtained from a browser running in Windows. Perhaps this is unsurprising given they include a mention of Windows in the "User-Agent" field!

What's more, I'm unable to Ctrl+C out when it hangs trying to connect.

Feel free to close this issue if you don't feel there's anything to be done about it.

WSL:

$python yt_music.py
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): music.youtube.com:443
^C^Z
[1]+  Stopped                 python -i yt_music.py
$kill %1
[1]+  Terminated              python -i yt_music.py

Command Prompt:

>python yt_music.py
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): music.youtube.com:443
DEBUG:urllib3.connectionpool:https://music.youtube.com:443 "POST /youtubei/v1/guide?alt=json&key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30 HTTP/1.1" 200 None
DEBUG:root:Connected
# yt_music.py

import logging, ytmusicapi

logging.basicConfig(level=logging.DEBUG)
ytmusic = ytmusicapi.YTMusic("headers_auth.json")
logging.debug("Connected")
Originally created by @LewisGaul on GitHub (Dec 28, 2020). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/134 Just wanted to point out, in case it's helpful, that it seems that it's not possible to connect from Windows Subsystem for Linux (version 1 at least) when the request headers have been obtained from a browser running in Windows. Perhaps this is unsurprising given they include a mention of Windows in the "User-Agent" field! What's more, I'm unable to Ctrl+C out when it hangs trying to connect. Feel free to close this issue if you don't feel there's anything to be done about it. WSL: ``` $python yt_music.py DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): music.youtube.com:443 ^C^Z [1]+ Stopped python -i yt_music.py $kill %1 [1]+ Terminated python -i yt_music.py ``` Command Prompt: ``` >python yt_music.py DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): music.youtube.com:443 DEBUG:urllib3.connectionpool:https://music.youtube.com:443 "POST /youtubei/v1/guide?alt=json&key=AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30 HTTP/1.1" 200 None DEBUG:root:Connected ``` ```python # yt_music.py import logging, ytmusicapi logging.basicConfig(level=logging.DEBUG) ytmusic = ytmusicapi.YTMusic("headers_auth.json") logging.debug("Connected")
kerem closed this issue 2026-02-27 22:08:00 +03:00
Author
Owner

@sigma67 commented on GitHub (Dec 30, 2020):

Not quite sure what issue you are facing here? The HTTP request in your log returns status code 200 which is correct. WSL or Linux should work with headers obtained on Windows browsers, in fact that's how I always set up my machines (get credentials on Win, automate on Linux).

<!-- gh-comment-id:752646890 --> @sigma67 commented on GitHub (Dec 30, 2020): Not quite sure what issue you are facing here? The HTTP request in your log returns status code 200 which is correct. WSL or Linux should work with headers obtained on Windows browsers, in fact that's how I always set up my machines (get credentials on Win, automate on Linux).
Author
Owner

@LewisGaul commented on GitHub (Dec 31, 2020):

Hm, interesting. I still can't get it to work on WSL using Python 3.6 or 3.8, and the fact Ctrl+C stops being handled is strange. If this works for you then maybe it's a problem with my environment - if I ever work it out I'll try to remember to update here, but for now running on Windows is fine for me.

<!-- gh-comment-id:752988948 --> @LewisGaul commented on GitHub (Dec 31, 2020): Hm, interesting. I still can't get it to work on WSL using Python 3.6 or 3.8, and the fact Ctrl+C stops being handled is strange. If this works for you then maybe it's a problem with my environment - if I ever work it out I'll try to remember to update here, but for now running on Windows is fine for me.
Author
Owner

@sigma67 commented on GitHub (Jan 3, 2021):

Please reopen if you can describe the root of the issue more clearly. I don't see why it shouldn't work on WSL, since it's just some basic web requests. Seems like a problem with your environment or WSL, not related to this package.

<!-- gh-comment-id:753683668 --> @sigma67 commented on GitHub (Jan 3, 2021): Please reopen if you can describe the root of the issue more clearly. I don't see why it shouldn't work on WSL, since it's just some basic web requests. Seems like a problem with your environment or WSL, not related to this package.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#97
No description provided.