INNER CODE UNIT · Python

cookie_value

cwuom/NeriPlayer · tools_pub/ytmusic_api_probe.py:358

def cookie_value(cookie_header: str, name: str) -> str:
    prefix = f"{name}="
    for chunk in cookie_header.split(";"):
        chunk = chunk.strip()
        if chunk.startswith(prefix):
            return chunk[len(prefix):]
    return ""


def has_login_cookie(cookie_header: str) -> bool:
    return any(
        cookie_value(cookie_header, name)
        for name in ("SAPISID", "__Secure-3PAPISID", "LOGIN_INFO", "SID")
    )


def append_youtube_consent_cookie(cookie_header: str) -> str:
    if not cookie_header:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…