<commit_before>import load from 'load-script';

export default () => {
    let iframeAPIReady;

    /**
     * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
     * The promise is resolved with a reference to window.YT object.
     *
     * @param {Function} resolve
     * @member {Object} iframeAPIReady
     */
    iframeAPIReady = new Promise((resolve) => {
        let previous;

        previous = window.onYouTubeIframeAPIReady;

        // The API will call this function when page has finished downloading
        // the JavaScript for the player API.
        window.onYouTubeIframeAPIReady = () => {
            if (previous) {
                previous();
            }

            resolve(window.YT);
        };
    });

    load('https://www.youtube.com/iframe_api');

    return iframeAPIReady;
};<commit_msg>fix: remove protocol dependency (#19)<commit_after>import load from 'load-script';

export default () => {
    let iframeAPIReady;

    /**
     * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
     * The promise is resolved with a reference to window.YT object.
     *
     * @param {Function} resolve
     * @member {Object} iframeAPIReady
     */
    iframeAPIReady = new Promise((resolve) => {
        let previous;

        previous = window.onYouTubeIframeAPIReady;

        // The API will call this function when page has finished downloading
        // the JavaScript for the player API.
        window.onYouTubeIframeAPIReady = () => {
            if (previous) {
                previous();
            }

            resolve(window.YT);
        };
    });

    load('//www.youtube.com/iframe_api');

    return iframeAPIReady;
};
{'fraction_non_alphanumeric': 0.10186263096623982, 'fraction_numerical': 0.0011641443538998836, 'mean_word_length': 2.1541284403669723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5871814', 'n_tokens_mistral': 487, 'n_tokens_neox': 483, 'n_words': 134}