diff options
| author | A Farzat <a@farzat.xyz> | 2025-10-14 08:43:50 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2025-10-14 08:43:50 +0300 |
| commit | 1d0d039c85af4aa62696ae4e368f688c25a7aa38 (patch) | |
| tree | 40a96da8c565dbd74a6df55f0d31c96467576429 /components/ytdlp | |
| parent | 9de3b56b9f6366d9d3907f00601be7bf984903fb (diff) | |
| download | csca5028-1d0d039c85af4aa62696ae4e368f688c25a7aa38.tar.gz csca5028-1d0d039c85af4aa62696ae4e368f688c25a7aa38.zip | |
Clean the remains of yt-dlp
Diffstat (limited to 'components/ytdlp')
| -rw-r--r-- | components/ytdlp/__init__.py | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/components/ytdlp/__init__.py b/components/ytdlp/__init__.py deleted file mode 100644 index 83fc1c8..0000000 --- a/components/ytdlp/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -from json import dumps -from random import randrange -from sys import stderr -from typing import Any, Dict - -from yt_dlp import YoutubeDL # type: ignore - -def obtain_vid_info(url: str) -> Dict[str, Any]: - ydl_opts = { "check_formats": False, } # We only want the durations. - try: - with YoutubeDL(ydl_opts) as ydl: - info = ydl.extract_info(url, download=False) - return { "duration_string": info["duration_string"] } - 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 obviously random - # string instead. - return { "duration_string": "-1:%02d" % randrange(60) } |
