[utils] Deprecate random_uuidv4 (#17301)

Authored by: doe1080
This commit is contained in:
doe1080
2026-08-19 15:42:14 +09:00
committed by GitHub
parent 4ce0e4d331
commit 0d1e029d14
4 changed files with 9 additions and 10 deletions
+1
View File
@@ -397,6 +397,7 @@ banned-from = [
"yt_dlp.utils.jwt_encode_hs256".msg = "Use `yt_dlp.utils.jwt_encode` instead."
"yt_dlp.utils.make_dir".msg = "Use `yt_dlp.utils.make_parent_dirs` instead."
"yt_dlp.utils.number_of_digits".msg = "Do not use"
"yt_dlp.utils.random_uuidv4".msg = "Use `str(uuid.uuid4())` instead."
"yt_dlp.utils.decodeArgument".msg = "Do not use"
"yt_dlp.utils.decodeFilename".msg = "Do not use"
"yt_dlp.utils.encodeFilename".msg = "Do not use"
+3 -3
View File
@@ -1,9 +1,9 @@
import urllib.parse
import uuid
from .common import InfoExtractor
from ..utils import (
ExtractorError,
random_uuidv4,
unified_timestamp,
urlencode_postdata,
)
@@ -77,11 +77,11 @@ class TennisTVIE(InfoExtractor):
query={
'client_id': 'tennis-tv-web',
'redirect_uri': 'https://www.tennistv.com/resources/v1.1.10/html/silent-check-sso.html',
'state': random_uuidv4(),
'state': str(uuid.uuid4()),
'response_mode': 'fragment',
'response_type': 'code',
'scope': 'openid',
'nonce': random_uuidv4(),
'nonce': str(uuid.uuid4()),
'prompt': 'none',
})
+5
View File
@@ -3,6 +3,7 @@ import base64
import hashlib
import hmac
import json
import uuid
import warnings
from ..compat.compat_utils import passthrough_module
@@ -62,4 +63,8 @@ def number_of_digits(number):
return len('%d' % number)
def random_uuidv4():
return str(uuid.uuid4())
compiled_regex_type = type(re.compile(''))
-7
View File
@@ -4730,13 +4730,6 @@ def clean_podcast_url(url):
return re.sub(r'^\w+://(\w+://)', r'\1', url)
_HEX_TABLE = '0123456789abcdef'
def random_uuidv4():
return re.sub(r'[xy]', lambda x: _HEX_TABLE[random.randint(0, 15)], 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx')
def make_parent_dirs(path):
if dir_name := os.path.dirname(path):
os.makedirs(dir_name, exist_ok=True)