INNER CODE UNIT · Python

parse_regions

cwuom/NeriPlayer · tools_pub/ytmusic_api_probe.py:490

def parse_regions(raw: str) -> list[tuple[str, str]]:
    pairs: list[tuple[str, str]] = []
    for item in raw.split(","):
        item = item.strip()
        if not item:
            continue
        if ":" not in item:
            raise ValueError(f"Invalid region pair: {item}")
        gl, hl = item.split(":", 1)
        pairs.append((gl.strip().upper(), hl.strip()))
    return pairs


def resolve_default_har_path(explicit: str) -> Path | None:
    if explicit:
        path = Path(explicit)
        return path if path.is_file() else None
    for candidate in HAR_DEFAULT_CANDIDATES:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…