<commit_before>Enable to add extra attributes to iframe
========================================

You can add any extra attributes to the ``<iframe>`` tag
since the argument ``extras`` has been added to the ``IFrame`` class.
for example::

    In [1]: from IPython.display import IFrame

    In [2]: print(IFrame(src="src", width=300, height=300, extras=["hello", "world"])._repr_html_())

            <iframe
                width="300"
                height="300"
                src="src"
                frameborder="0"
                allowfullscreen
                hello world
            ></iframe>

Using it, you can autoplay ``YouTubeVideo`` by adding ``'allow="autoplay"'``,
even in browsers that disable it by default, such as Google Chrome.
And, you can write it more briefly by using the argument ``allow_autoplay``.
::

    In [1]: from IPython.display import YouTubeVideo

    In [2]: print(YouTubeVideo("video-id", allow_autoplay=True)._repr_html_())

            <iframe
                width="400"
                height="300"
                src="https://www.youtube.com/embed/video-id?autoplay=1"
                frameborder="0"
                allowfullscreen
                allow="autoplay"
            ></iframe><commit_msg>Reword the YouTubeVideo autoplay WN<commit_after>``YouTubeVideo`` autoplay and the ability to add extra attributes to ``IFrame``
===============================================================================

You can add any extra attributes to the ``<iframe>`` tag using the new
``extras`` argument in the ``IFrame`` class. For example::

    In [1]: from IPython.display import IFrame

    In [2]: IFrame(src="src", width=300, height=300, extras=['loading="eager"'])

The above cells will result in the following HTML code being displayed in a
notebook::

    <iframe
        width="300"
        height="300"
        src="src"
        frameborder="0"
        allowfullscreen
        loading="eager"
    ></iframe>

Related to the above, the ``YouTubeVideo`` class now takes an
``allow_autoplay`` flag, which sets up the iframe of the embedded YouTube video
such that it allows autoplay.

.. note::
    Whether this works depends on whether the autoplay policy of the browser
    rendering the HTML allows it. It might not work in every circumstance, and
    could get blocked by browser extensions.

Try it out!
::

    In [1]: from IPython.display import YouTubeVideo

    In [2]: YouTubeVideo("dQw4w9WgXcQ", allow_autoplay=True)

🙃
{'fraction_non_alphanumeric': 0.14883346741753822, 'fraction_numerical': 0.017699115044247787, 'mean_word_length': 2.910377358490566, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6439121', 'n_tokens_mistral': 736, 'n_tokens_neox': 669, 'n_words': 246}