Skip to main content

web/yt-dlp: replace hyperlink with standard library

ID
794c8f5
date
2026-04-15 20:13:56+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
24090cc
message
web/yt-dlp: replace hyperlink with standard library
changed files
1 file, 6 additions, 4 deletions

Changed files

web/yt-dlp.py (4003) → web/yt-dlp.py (4041)

diff --git a/web/yt-dlp.py b/web/yt-dlp.py
index 25fad21..4e6f124 100755
--- a/web/yt-dlp.py
+++ b/web/yt-dlp.py
@@ -20,8 +20,8 @@ import concurrent.futures
 import os
 import subprocess
 import sys
+import urllib.parse
 
-import hyperlink
 import termcolor
 import tqdm
 
@@ -30,11 +30,13 @@ def is_youtube_playlist(url: str) -> bool:
     """
     Returns True if a YouTube URL is a playlist, false otherwise.
     """
-    u = hyperlink.DecodedURL.from_text(url)
-    assert "youtube.com" in u.host
+    u = urllib.parse.urlsplit(url)
+    assert "youtube.com" in u.netloc
+
+    query = urllib.parse_qs(u.query)
 
     # Look for a non-empty playlist which isn't WL (Watch Later)
-    return bool(u.get("list")) and u.get("list") != ["WL"]
+    return bool(query.get("list") and u.get("list") != ["WL"])
 
 
 def get_playlist_video_ids(youtube_url: str) -> Iterator[str]: