aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/yt_dlp_plugins/extractor/radiko.py
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2024-03-06 06:11:35 +0000
committergarret <garret@airmail.cc>2024-03-06 06:56:53 +0000
commit4e65874e621ab13fa8367c426aaf8231768eb20f (patch)
tree2018bdc5b83a71b479d713241b98be64147960b7 /yt_dlp_plugins/extractor/radiko.py
parent49fe5c3a1cc43b593a76c886b6673d44baa665f1 (diff)
downloadyt-dlp-rajiko-4e65874e621ab13fa8367c426aaf8231768eb20f.tar.gz
yt-dlp-rajiko-4e65874e621ab13fa8367c426aaf8231768eb20f.tar.bz2
yt-dlp-rajiko-4e65874e621ab13fa8367c426aaf8231768eb20f.zip
remove dependency on secrets
it does not need to be cryptographically strong only using token_hex for convenience
Diffstat (limited to 'yt_dlp_plugins/extractor/radiko.py')
-rw-r--r--yt_dlp_plugins/extractor/radiko.py5
1 files changed, 2 insertions, 3 deletions
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
})