From 4e65874e621ab13fa8367c426aaf8231768eb20f Mon Sep 17 00:00:00 2001 From: garret Date: Wed, 6 Mar 2024 06:11:35 +0000 Subject: remove dependency on secrets it does not need to be cryptographically strong only using token_hex for convenience --- yt_dlp_plugins/extractor/radiko.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'yt_dlp_plugins') diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index f36ee4d..69a63fc 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -1,7 +1,6 @@ import base64 import datetime import random -import secrets import urllib.parse from yt_dlp.extractor.common import InfoExtractor @@ -402,7 +401,7 @@ class _RadikoBaseIE(InfoExtractor): "X-Radiko-App": "aSmartPhone7a", "X-Radiko-App-Version": random.choice(self._APP_VERSIONS), "X-Radiko-Device": f"{sdk}.{model}", - "X-Radiko-User": secrets.token_hex(16), + "X-Radiko-User": ''.join(random.choices('0123456789abcdef', k=32)), "User-Agent": f"Dalvik/2.1.0 (Linux; U; Android {android_version};{model}/{build})", } return info @@ -864,7 +863,7 @@ class RadikoSearchIE(_RadikoBaseIE): search_url = update_url_query("https://radiko.jp/v3/api/program/search", { **queries, - "uid": secrets.token_hex(16), + "uid": ''.join(random.choices('0123456789abcdef', k=32)), "app_id": "pc", "row_limit": 50, # higher row_limit = more results = less requests = more good }) -- cgit v1.2.3-70-g09d2