[utils] Handle user:pass in URLs (#28801)
authorHubert Hirtz <hubert@hirtz.pm>
Mon, 4 Mar 2024 01:27:55 +0000 (01:27 +0000)
committerGitHub <noreply@github.com>
Mon, 4 Mar 2024 01:27:55 +0000 (01:27 +0000)
commitf0812d784836d18fd25ea32f9b5a0c9c6e92425b
tree173402901f9b0ea2c025d67287451f916cec447c
parent40bd5c18153afe765caa6726302ee1dd8a9a2ce6
[utils] Handle user:pass in URLs (#28801)

* Handle user:pass in URLs

Fixes "nonnumeric port" errors when youtube-dl is given URLs with
usernames and passwords such as:

    http://username:password@example.com/myvideo.mp4

Refs:
- https://en.wikipedia.org/wiki/Basic_access_authentication
- https://tools.ietf.org/html/rfc1738#section-3.1
- https://docs.python.org/3.8/library/urllib.parse.html#urllib.parse.urlsplit

Fixes #18276 (point 4)
Fixes #20258
Fixes #26211 (see comment)

* Align code with yt-dlp

---------

Co-authored-by: dirkf <fieldhouse@gmx.net>
test/test_utils.py
youtube_dl/utils.py