blob: c4bd4d063c64deae8936a4f58dd2329a74f69b61 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
|
from typing import Any, Dict
from json import dumps
from yt_dlp import YoutubeDL # type: ignore
def obtain_vid_info(url: str) -> Dict[str, Any]:
ydl_opts = { "check_formats": False, }
with YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=False)
return {"duration": info["duration"]}
|