]> jfr.im git - yt-dlp.git/commitdiff
[utils] Fix `get_domain`
authorpukkandan <redacted>
Wed, 13 Jul 2022 14:12:52 +0000 (19:42 +0530)
committerpukkandan <redacted>
Wed, 13 Jul 2022 14:14:19 +0000 (19:44 +0530)
Bug in ae61d108dd83a951b6e8a27e1fb969682416150d

Closes #4344

yt_dlp/utils.py

index a347a50bcf00bc721fe85140c90ff57860d20dfd..6e0c31c012ec0b5c4b69bd387bf2844a0dc472c6 100644 (file)
@@ -2405,7 +2405,11 @@ def remove_quotes(s):
 
 
 def get_domain(url):
-    return '.'.join(urllib.parse.urlparse(url).netloc.rsplit('.', 2)[-2:])
+    """
+    This implementation is inconsistent, but is kept for compatibility.
+    Use this only for "webpage_url_domain"
+    """
+    return remove_start(urllib.parse.urlparse(url).netloc, 'www.') or None
 
 
 def url_basename(url):