Download static/js/test.py from Fvitu/Offliner: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/spaces/Fvitu/Offliner/resolve/main/static/js/test.py
- Command line
-
hf download hf://spaces/Fvitu/Offliner/static/js/test.py
-
curl -L -o test.py https://huggingface.co/spaces/Fvitu/Offliner/resolve/main/static/js/test.py
904 Bytes
| from pathlib import Path | |
| import sys | |
| import yt_dlp | |
| # ensure project root (two levels up: Offliner) is on sys.path so `logic` can be imported | |
| project_root = Path(__file__).resolve().parents[2] | |
| sys.path.insert(0, str(project_root)) | |
| from logic import OfflinerCore | |
| url = "https://www.youtube.com/watch?v=HfQ1XIFRbO0" | |
| cookiefile = Path(r"c:/Archivos/Proyectos Python/Offliner/cookies3.txt") | |
| core = OfflinerCore() | |
| opts = core._base_ytdlp_opts(cookiefile) | |
| opts.update({"skip_download": True, "format": "best", "noplaylist": True, "check_formats": None}) | |
| try: | |
| with yt_dlp.YoutubeDL(opts) as ydl: | |
| info = ydl.extract_info(url, download=False) | |
| print({ | |
| "title": info.get("title"), | |
| "age_limit": info.get("age_limit"), | |
| "formats": len(info.get("formats", [])), | |
| }) | |
| except Exception as exc: | |
| print(type(exc).__name__, exc) | |