from __future__ import annotations import re import subprocess import sys from pathlib import Path from urllib.parse import unquote VIDEO_TAG_RE = re.compile( r"[^>]*)>(?P.*?)", re.IGNORECASE | re.DOTALL, ) SOURCE_RE = re.compile( r']+src=["\'](?P[^"\']+)["\'][^>]*>', re.IGNORECASE, ) def extract_src(video_attrs: str, video_body: str) -> str | None: """Extract video path from either " new_content = VIDEO_TAG_RE.sub(replace_video, content) if changed: html_file.write_text(new_content, encoding="utf-8") print(f"Updated: {html_file}") def main() -> None: """Process all HTML files below the given root directory.""" root = Path(sys.argv[1]).resolve() for html_file in root.rglob("*.html"): process_file(html_file, root) if __name__ == "__main__": main()