diff options
| author | A Farzat <a@farzat.xyz> | 2025-10-05 08:47:47 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2025-10-05 08:47:47 +0300 |
| commit | 8b61cb7f0374c804373937b9c041e3f11c95d366 (patch) | |
| tree | 98a7c9e1a9af6cf0b8476c0b11ddeba9a2c95579 /components | |
| parent | 79855563ffdb82d9dce02587708c65467473ec22 (diff) | |
| download | csca5028-8b61cb7f0374c804373937b9c041e3f11c95d366.tar.gz csca5028-8b61cb7f0374c804373937b9c041e3f11c95d366.zip | |
Make ytdlp's replacement string obviously random
Diffstat (limited to 'components')
| -rw-r--r-- | components/ytdlp/__init__.py | 7 |
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) } |
