import logging
import json


def extract_initial_data(html):
    """Extract and parse the JSON string from the HTML of a playlist webpage.

    Parameters
    ----------
    html : str
        HTML to extract the string from.

    Returns
    -------
    Dict
        Parsed JSON data.

    """
    logging.info("Extracting JSON string from playlist HTML data")
    for line in html.split("\n"):
        if line.strip().startswith('window["ytInitialData"]'):
            return json.loads(line.strip()[26:-1])
    return None