summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2025-10-05 08:47:47 +0300
committerA Farzat <a@farzat.xyz>2025-10-05 08:47:47 +0300
commit8b61cb7f0374c804373937b9c041e3f11c95d366 (patch)
tree98a7c9e1a9af6cf0b8476c0b11ddeba9a2c95579
parent79855563ffdb82d9dce02587708c65467473ec22 (diff)
downloadcsca5028-8b61cb7f0374c804373937b9c041e3f11c95d366.tar.gz
csca5028-8b61cb7f0374c804373937b9c041e3f11c95d366.zip
Make ytdlp's replacement string obviously random
-rw-r--r--components/ytdlp/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/components/ytdlp/__init__.py b/components/ytdlp/__init__.py
index e63858c..83fc1c8 100644
--- a/components/ytdlp/__init__.py
+++ b/components/ytdlp/__init__.py
@@ -1,4 +1,5 @@
from json import dumps
+from random import randrange
from sys import stderr
from typing import Any, Dict
@@ -13,6 +14,6 @@ def obtain_vid_info(url: str) -> Dict[str, Any]:
except Exception as e:
print("Ran into an exception while fetching", url + ":", e, file=stderr)
# This is a dummy project. If yt-dlp fails, repeatedly parsing YouTube
- # would only get us possibly blocked. Better return an empty string
- # instead.
- return { "duration_string": "" }
+ # would only get us possibly blocked. Better return an obviously random
+ # string instead.
+ return { "duration_string": "-1:%02d" % randrange(60) }