code:
#!/usr/bin/env python3

# Allow direct execution
import os
import sys
import unittest

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import contextlib
import re
import string
import urllib.request

from test.helper import FakeYDL, is_download_test
from yt_dlp.extractor import YoutubeIE
from yt_dlp.jsinterp import JSInterpreter

_SIG_TESTS = [
    (
        'https://s.ytimg.com/yts/jsbin/html5player-vflHOr_nV.js',
        86,
        '>=<;:/.-[+*)(\'&%$#"!ZYX0VUTSRQPONMLKJIHGFEDCBA\\yxwvutsrqponmlkjihgfedcba987654321',
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-vfldJ8xgI.js',
        85,
        '3456789a0cdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS[UVWXYZ!"#$%&\'()*+,-./:;<=>?@',
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-vfle-mVwz.js',
        90,
        ']\\[@?>=<;:/.-,+*)(\'&%$#"hZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjiagfedcb39876',
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-en_US-vfl0Cbn9e.js',
        84,
        'O1I3456789abcde0ghijklmnopqrstuvwxyzABCDEFGHfJKLMN2PQRSTUVW@YZ!"#$%&\'()*+,-./:;<=',
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflXGBaUN.js',
        '2ACFC7A61CA478CD21425E5A57EBD73DDC78E22A.2094302436B2D377D14A3BBA23022D023B8BC25AA',
        'A52CB8B320D22032ABB3A41D773D2B6342034902.A22E87CDD37DBE75A5E52412DC874AC16A7CFCA2',
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflBb0OQx.js',
        84,
        '123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ0STUVWXYZ!"#$%&\'()*+,@./:;<=>'
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-en_US-vfl9FYC6l.js',
        83,
        '123456789abcdefghijklmnopqr0tuvwxyzABCDETGHIJKLMNOPQRS>UVWXYZ!"#$%&\'()*+,-./:;<=F'
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflCGk6yw/html5player.js',
        '4646B5181C6C3020DF1D9C7FCFEA.AD80ABF70C39BD369CCCAE780AFBB98FA6B6CB42766249D9488C288',
        '82C8849D94266724DC6B6AF89BBFA087EACCD963.B93C07FBA084ACAEFCF7C9D1FD0203C6C1815B6B'
    ),
    (
        'https://s.ytimg.com/yts/jsbin/html5player-en_US-vflKjOTVq/html5player.js',
        '312AA52209E3623129A412D56A40F11CB0AF14AE.3EE09501CB14E3BCDC3B2AE808BF3F1D14E7FBF12',
        '112AA5220913623229A412D56A40F11CB0AF14AE.3EE0950FCB14EEBCDC3B2AE808BF331D14E7FBF3',
    )
]

_NSIG_TESTS = [
    (
        'https://www.youtube.com/s/player/9216d1f7/player_ias.vflset/en_US/base.js',
        'SLp9F5bwjAdhE9F-', 'gWnb9IK2DJ8Q1w',
    ),
    (
        'https://www.youtube.com/s/player/f8cb7a3b/player_ias.vflset/en_US/base.js',
        'oBo2h5euWy6osrUt', 'ivXHpm7qJjJN',
    ),
    (
        'https://www.youtube.com/s/player/2dfe380c/player_ias.vflset/en_US/base.js',
        'oBo2h5euWy6osrUt', '3DIBbn3qdQ',
    ),
    (
        'https://www.youtube.com/s/player/f1ca6900/player_ias.vflset/en_US/base.js',
        'cu3wyu6LQn2hse', 'jvxetvmlI9AN9Q',
    ),
    (
        'https://www.youtube.com/s/player/8040e515/player_ias.vflset/en_US/base.js',
        'wvOFaY-yjgDuIEg5', 'HkfBFDHmgw4rsw',
    ),
    (
        'https://www.youtube.com/s/player/e06dea74/player_ias.vflset/en_US/base.js',
        'AiuodmaDDYw8d3y4bf', 'ankd8eza2T6Qmw',
    ),
    (
        'https://www.youtube.com/s/player/5dd88d1d/player-plasma-ias-phone-en_US.vflset/base.js',
        'kSxKFLeqzv_ZyHSAt', 'n8gS8oRlHOxPFA',
    ),
    (
        'https://www.youtube.com/s/player/324f67b9/player_ias.vflset/en_US/base.js',
        'xdftNy7dh9QGnhW', '22qLGxrmX8F1rA',
    ),
    (
        'https://www.youtube.com/s/player/4c3f79c5/player_ias.vflset/en_US/base.js',
        'TDCstCG66tEAO5pR9o', 'dbxNtZ14c-yWyw',
    ),
    (
        'https://www.youtube.com/s/player/c81bbb4a/player_ias.vflset/en_US/base.js',
        'gre3EcLurNY2vqp94', 'Z9DfGxWP115WTg',
    ),
    (
        'https://www.youtube.com/s/player/1f7d5369/player_ias.vflset/en_US/base.js',
        'batNX7sYqIJdkJ', 'IhOkL_zxbkOZBw',
    ),
    (
        'https://www.youtube.com/s/player/009f1d77/player_ias.vflset/en_US/base.js',
        '5dwFHw8aFWQUQtffRq', 'audescmLUzI3jw',
    ),
    (
        'https://www.youtube.com/s/player/dc0c6770/player_ias.vflset/en_US/base.js',
        '5EHDMgYLV6HPGk_Mu-kk', 'n9lUJLHbxUI0GQ',
    ),
    (
        'https://www.youtube.com/s/player/113ca41c/player_ias.vflset/en_US/base.js',
        'cgYl-tlYkhjT7A', 'hI7BBr2zUgcmMg',
    ),
    (
        'https://www.youtube.com/s/player/c57c113c/player_ias.vflset/en_US/base.js',
        'M92UUMHa8PdvPd3wyM', '3hPqLJsiNZx7yA',
    ),
    (
        'https://www.youtube.com/s/player/5a3b6271/player_ias.vflset/en_US/base.js',
        'B2j7f_UPT4rfje85Lu_e', 'm5DmNymaGQ5RdQ',
    ),
]

@is_download_test
class TestPlayerInfo(unittest.TestCase):
    def test_youtube_extract_player_info(self):
        PLAYER_URLS = (
            ('https://www.youtube.com/s/player/4c3f79c5/player_ias.vflset/en_US/base.js', '4c3f79c5'),
            ('https://www.youtube.com/s/player/64dddad9/player_ias.vflset/en_US/base.js', '64dddad9'),
            ('https://www.youtube.com/s/player/64dddad9/player_ias.vflset/fr_FR/base.js', '64dddad9'),
            ('https://www.youtube.com/s/player/64dddad9/player-plasma-ias-phone-en_US.vflset/base.js', '64dddad9'),
            ('https://www.youtube.com/s/player/64dddad9/player-plasma-ias-phone-de_DE.vflset/base.js', '64dddad9'),
            ('https://www.youtube.com/s/player/64dddad9/player-plasma-ias-tablet-en_US.vflset/base.js', '64dddad9'),
            # obsolete
            ('https://www.youtube.com/yts/jsbin/player_ias-vfle4-e03/en_US/base.js', 'vfle4-e03'),
            ('https://www.youtube.com/yts/jsbin/player_ias-vfl49f_g4/en_US/base.js', 'vfl49f_g4'),
            ('https://www.youtube.com/yts/jsbin/player_ias-vflCPQUIL/en_US/base.js', 'vflCPQUIL'),
            ('https://www.youtube.com/yts/jsbin/player-vflzQZbt7/en_US/base.js', 'vflzQZbt7'),
            ('https://www.youtube.com/yts/jsbin/player-en_US-vflaxXRn1/base.js', 'vflaxXRn1'),
            ('https://s.ytimg.com/yts/jsbin/html5player-en_US-vflXGBaUN.js', 'vflXGBaUN'),
            ('https://s.ytimg.com/yts/jsbin/html5player-en_US-vflKjOTVq/html5player.js', 'vflKjOTVq'),
        )
        for player_url, expected_player_id in PLAYER_URLS:
            player_id = YoutubeIE._extract_player_info(player_url)
            self.assertEqual(player_id, expected_player_id)

@is_download_test
class TestSignature(unittest.TestCase):
    def setUp(self):
        TEST_DIR = os.path.dirname(os.path.abspath(__file__))
        self.TESTDATA_DIR = os.path.join(TEST_DIR, 'testdata/sigs')
        if not os.path.exists(self.TESTDATA_DIR):
            os.mkdir(self.TESTDATA_DIR)

    def tearDown(self):
        with contextlib.suppress(OSError):
            for f in os.listdir(self.TESTDATA_DIR):
                os.remove(f)

def t_factory(name, sig_func, url_pattern):
    def make_tfunc(url, sig_input, expected_sig):
        m = url_pattern.match(url)
        assert m, '%r should follow URL format' % url
        test_id = m.group('id')

        def test_func(self):
            basename = f'player-{name}-{test_id}.js'
            fn = os.path.join(self.TESTDATA_DIR, basename)

            if not os.path.exists(fn):
                urllib.request.urlretrieve(url, fn)
            with open(fn, encoding='utf-8') as testf:
                jscode = testf.read()
            self.assertEqual(sig_func(jscode, sig_input), expected_sig)

        test_func.__name__ = f'test_{name}_js_{test_id}'
        setattr(TestSignature, test_func.__name__, test_func)
    return make_tfunc

def signature(jscode, sig_input):
    func = YoutubeIE(FakeYDL())._parse_sig_js(jscode)
    src_sig = (
        str(string.printable[:sig_input])
        if isinstance(sig_input, int) else sig_input)
    return func(src_sig)

def n_sig(jscode, sig_input):
    funcname = YoutubeIE(FakeYDL())._extract_n_function_name(jscode)
    return JSInterpreter(jscode).call_function(funcname, sig_input)

make_sig_test = t_factory(
    'signature', signature, re.compile(r'.*-(?P<id>[a-zA-Z0-9_-]+)(?:/watch_as3|/html5player)?\.[a-z]+$'))
for test_spec in _SIG_TESTS:
    make_sig_test(*test_spec)

make_nsig_test = t_factory(
    'nsig', n_sig, re.compile(r'.+/player/(?P<id>[a-zA-Z0-9_-]+)/.+.js$'))
for test_spec in _NSIG_TESTS:
    make_nsig_test(*test_spec)

if __name__ == '__main__':
    unittest.main()


code:
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIG2L1bHdl3PnaLiJ7Zm8aAGCj4GiVbSbXQcrJAdL+yqOoAoGCCqGSM49
AwEHoUQDQgAEcTaKMtIn2/1kgid1zXFpLm87FMT5PP3/bltKVVH3DLO//0kUslCH
YxFUKpcCfVt9aueRyUFi1TNkkkEZ9D6fbg==
-----END EC PRIVATE KEY-----

repo_name: Lesmiscore/ytdl


code:
-----BEGIN CERTIFICATE REQUEST-----
MIHQMHcCAQAwFTETMBEGA1UEAwwKeXRkbHB0ZXN0MjBZMBMGByqGSM49AgEGCCqG
SM49AwEHA0IABKREKVDWfLKZknzYg+BUkmTn43f2pl/LNSyKPtXo/UV7hhp6JXIq
3ZuZ7rubyuMSXNuH+2Cl9msSpJB2LhJs5kegADAKBggqhkjOPQQDAgNJADBGAiEA
1LZ72mtPmVxhGtdMvpZ0fyA68H2RC5IMHpLq18T55UcCIQDKpkXXVTvAzS0JioCq
6kiYq8Oxx6ZMoI+11k75/Kip1g==
-----END CERTIFICATE REQUEST-----


code:
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIAW6h9hwT0Aha+JBukgmHnrKRPoqPNWYA86ic0UaKHs8oAoGCCqGSM49
AwEHoUQDQgAEpEQpUNZ8spmSfNiD4FSSZOfjd/amX8s1LIo+1ej9RXuGGnolcird
m5nuu5vK4xJc24f7YKX2axKkkHYuEmzmRw==
-----END EC PRIVATE KEY-----


code:
-----BEGIN EC PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,4B39160146F15544922E553E08299A35

96A7/iBkIfTVb8r2812ued2pS49FfVY4Ppz/45OGF0uFayMtMl8/GuEBCamuhFXS
rnOOpco96TTeeKZHqR45wnf4tgHM8IjoQ6H0EX3lVF19OHnArAgrGYtohWUGSyGn
IgLJFdUewIjdI7XApTJprQFE5E2tETXFA95mCz88u1c=
-----END EC PRIVATE KEY-----


code:
-----BEGIN CERTIFICATE-----
MIIBIzCBygIUSiYMM8TTRhJkbmMh4edn3xqV7wswCgYIKoZIzj0EAwIwFDESMBAG
A1UEAwwJeXRkbHB0ZXN0MB4XDTIyMDQxNTAzMDEyN1oXDTM4MTAxNTAzMDEyN1ow
FTETMBEGA1UEAwwKeXRkbHB0ZXN0MjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
BKREKVDWfLKZknzYg+BUkmTn43f2pl/LNSyKPtXo/UV7hhp6JXIq3ZuZ7rubyuMS
XNuH+2Cl9msSpJB2LhJs5kcwCgYIKoZIzj0EAwIDSAAwRQIhAMRr46vO25/5nUhD
aHp4L67AeSvrjvSFHfubyD3Kr5dwAiA8EfOgVxc8Qh6ozTcbXO/WnBfS48ZFRSQY
D0dB8M1kJw==
-----END CERTIFICATE-----
-----BEGIN EC PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,4B39160146F15544922E553E08299A35

96A7/iBkIfTVb8r2812ued2pS49FfVY4Ppz/45OGF0uFayMtMl8/GuEBCamuhFXS
rnOOpco96TTeeKZHqR45wnf4tgHM8IjoQ6H0EX3lVF19OHnArAgrGYtohWUGSyGn
IgLJFdUewIjdI7XApTJprQFE5E2tETXFA95mCz88u1c=
-----END EC PRIVATE KEY-----


code:
-----BEGIN CERTIFICATE-----
MIIBIzCBygIUSiYMM8TTRhJkbmMh4edn3xqV7wswCgYIKoZIzj0EAwIwFDESMBAG
A1UEAwwJeXRkbHB0ZXN0MB4XDTIyMDQxNTAzMDEyN1oXDTM4MTAxNTAzMDEyN1ow
FTETMBEGA1UEAwwKeXRkbHB0ZXN0MjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
BKREKVDWfLKZknzYg+BUkmTn43f2pl/LNSyKPtXo/UV7hhp6JXIq3ZuZ7rubyuMS
XNuH+2Cl9msSpJB2LhJs5kcwCgYIKoZIzj0EAwIDSAAwRQIhAMRr46vO25/5nUhD
aHp4L67AeSvrjvSFHfubyD3Kr5dwAiA8EfOgVxc8Qh6ozTcbXO/WnBfS48ZFRSQY
D0dB8M1kJw==
-----END CERTIFICATE-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIAW6h9hwT0Aha+JBukgmHnrKRPoqPNWYA86ic0UaKHs8oAoGCCqGSM49
AwEHoUQDQgAEpEQpUNZ8spmSfNiD4FSSZOfjd/amX8s1LIo+1ej9RXuGGnolcird
m5nuu5vK4xJc24f7YKX2axKkkHYuEmzmRw==
-----END EC PRIVATE KEY-----


code:
# Generate certificates for client cert tests

## CA
```sh
openssl ecparam -name prime256v1 -genkey -noout -out ca.key
openssl req -new -x509 -sha256 -days 6027 -key ca.key -out ca.crt -subj "/CN=ytdlptest"
```

## Client
```sh
openssl ecparam -name prime256v1 -genkey -noout -out client.key
openssl ec -in client.key -out clientencrypted.key -passout pass:foobar -aes256
openssl req -new -sha256 -key client.key -out client.csr -subj "/CN=ytdlptest2"
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 6027 -sha256
cp client.crt clientwithkey.crt
cp client.crt clientwithencryptedkey.crt
cat client.key >> clientwithkey.crt
cat clientencrypted.key >> clientwithencryptedkey.crt
```


code:
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

#HttpOnly_www.foobar.foobar	FALSE	/	TRUE	2147483647	HTTPONLY_COOKIE	HTTPONLY_COOKIE_VALUE
www.foobar.foobar	FALSE	/	TRUE	2147483647	JS_ACCESSIBLE_COOKIE	JS_ACCESSIBLE_COOKIE_VALUE


code:
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

# Cookie file entry with invalid number of fields - 6 instead of 7
www.foobar.foobar	FALSE	/	FALSE	0	COOKIE

# Cookie file entry with invalid expires at
www.foobar.foobar	FALSE	/	FALSE	1.7976931348623157e+308	COOKIE	VALUE


code:
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file!  Do not edit.

www.foobar.foobar	FALSE	/	TRUE		YoutubeDLExpiresEmpty	YoutubeDLExpiresEmptyValue
www.foobar.foobar	FALSE	/	TRUE	0	YoutubeDLExpires0	YoutubeDLExpires0Value


code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns="http://ns.adobe.com/f4m/1.0">
    <streamType>recorded</streamType>
    <baseURL>http://vod.livestream.com/events/0000000000673980/</baseURL>
    <duration>269.293</duration>
    <bootstrapInfo profile="named" id="bootstrap_1">AAAAm2Fic3QAAAAAAAAAAQAAAAPoAAAAAAAEG+0AAAAAAAAAAAAAAAAAAQAAABlhc3J0AAAAAAAAAAABAAAAAQAAAC4BAAAAVmFmcnQAAAAAAAAD6AAAAAAEAAAAAQAAAAAAAAAAAAAXcAAAAC0AAAAAAAQHQAAAE5UAAAAuAAAAAAAEGtUAAAEYAAAAAAAAAAAAAAAAAAAAAAA=</bootstrapInfo>
    <media url="b90f532f-b0f6-4f4e-8289-706d490b2fd8_2292" bootstrapInfoId="bootstrap_1" bitrate="2148" width="1280" height="720" videoCodec="avc1.4d401f" audioCodec="mp4a.40.2">
        <metadata>AgAKb25NZXRhRGF0YQgAAAAIAAhkdXJhdGlvbgBAcNSwIMSbpgAFd2lkdGgAQJQAAAAAAAAABmhlaWdodABAhoAAAAAAAAAJZnJhbWVyYXRlAEA4/7DoLwW3AA12aWRlb2RhdGFyYXRlAECe1DLgjcobAAx2aWRlb2NvZGVjaWQAQBwAAAAAAAAADWF1ZGlvZGF0YXJhdGUAQGSimlvaPKQADGF1ZGlvY29kZWNpZABAJAAAAAAAAAAACQ==</metadata>
    </media>
</manifest>


code:
#!/usr/bin/env python3
from __future__ import unicode_literals

if __name__ == '__main__':
    import sys

    filename = sys.argv[1]

    sys.exit(0 if "it's a small world" in filename.lower() else 1)


code:
<?xml version="1.0" encoding="UTF-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" type="static" minBufferTime="PT2S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" mediaPresentationDuration="PT6014S">
	<Period bitstreamSwitching="true">
		<AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" startWithSAP="1" segmentAlignment="true">
			<SegmentTemplate timescale="1000000" presentationTimeOffset="0" initialization="ai_$RepresentationID$.mp4d" media="a_$RepresentationID$_$Number$.mp4d" duration="2000000.0" startNumber="0"></SegmentTemplate>
			<Representation id="318597" bandwidth="61587"></Representation>
		</AdaptationSet>
		<AdaptationSet mimeType="video/mp4" startWithSAP="1" segmentAlignment="true">
			<SegmentTemplate timescale="1000000" presentationTimeOffset="0" initialization="vi_$RepresentationID$.mp4d" media="v_$RepresentationID$_$Number$.mp4d" duration="2000000.0" startNumber="0"></SegmentTemplate>
			<Representation id="318597" codecs="avc1.42001f" width="340" height="192" bandwidth="318597"></Representation>
			<Representation id="638590" codecs="avc1.42001f" width="512" height="288" bandwidth="638590"></Representation>
			<Representation id="1022565" codecs="avc1.4d001f" width="688" height="384" bandwidth="1022565"></Representation>
			<Representation id="2046506" codecs="avc1.4d001f" width="1024" height="576" bandwidth="2046506"></Representation>
			<Representation id="3998017" codecs="avc1.640029" width="1280" height="720" bandwidth="3998017"></Representation>
			<Representation id="5997485" codecs="avc1.640032" width="1920" height="1080" bandwidth="5997485"></Representation>
		</AdaptationSet>
	</Period>
</MPD>


code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Unified Streaming Platform (version=1.10.18-20255) -->
<MPD
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:mpeg:dash:schema:mpd:2011"
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
  type="static"
  mediaPresentationDuration="PT14M48S"
  maxSegmentDuration="PT1M"
  minBufferTime="PT10S"
  profiles="urn:mpeg:dash:profile:isoff-live:2011">
  <Period
    id="1"
    duration="PT14M48S">
    <BaseURL>dash/</BaseURL>
    <AdaptationSet
      id="1"
      group="1"
      contentType="audio"
      segmentAlignment="true"
      audioSamplingRate="48000"
      mimeType="audio/mp4"
      codecs="mp4a.40.2"
      startWithSAP="1">
      <AudioChannelConfiguration
        schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
        value="2" />
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <SegmentTemplate
        timescale="48000"
        initialization="3144-kZT4LWMQw6Rh7Kpd-$RepresentationID$.dash"
        media="3144-kZT4LWMQw6Rh7Kpd-$RepresentationID$-$Time$.dash">
        <SegmentTimeline>
          <S t="0" d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="96256" r="2" />
          <S d="95232" />
          <S d="3584" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="audio=128001"
        bandwidth="128001">
      </Representation>
    </AdaptationSet>
    <AdaptationSet
      id="2"
      group="3"
      contentType="text"
      lang="en"
      mimeType="application/mp4"
      codecs="stpp"
      startWithSAP="1">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle" />
      <SegmentTemplate
        timescale="1000"
        initialization="3144-kZT4LWMQw6Rh7Kpd-$RepresentationID$.dash"
        media="3144-kZT4LWMQw6Rh7Kpd-$RepresentationID$-$Time$.dash">
        <SegmentTimeline>
          <S t="0" d="60000" r="9" />
          <S d="24000" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="textstream_eng=1000"
        bandwidth="1000">
      </Representation>
    </AdaptationSet>
    <AdaptationSet
      id="3"
      group="2"
      contentType="video"
      par="960:409"
      minBandwidth="100000"
      maxBandwidth="4482000"
      maxWidth="1689"
      maxHeight="720"
      segmentAlignment="true"
      mimeType="video/mp4"
      codecs="avc1.4D401F"
      startWithSAP="1">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main" />
      <SegmentTemplate
        timescale="12288"
        initialization="3144-kZT4LWMQw6Rh7Kpd-$RepresentationID$.dash"
        media="3144-kZT4LWMQw6Rh7Kpd-$RepresentationID$-$Time$.dash">
        <SegmentTimeline>
          <S t="0" d="24576" r="443" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="video=100000"
        bandwidth="100000"
        width="336"
        height="144"
        sar="2880:2863"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=326000"
        bandwidth="326000"
        width="562"
        height="240"
        sar="115200:114929"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=698000"
        bandwidth="698000"
        width="844"
        height="360"
        sar="86400:86299"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=1493000"
        bandwidth="1493000"
        width="1126"
        height="480"
        sar="230400:230267"
        scanType="progressive">
      </Representation>
      <Representation
        id="video=4482000"
        bandwidth="4482000"
        width="1688"
        height="720"
        sar="86400:86299"
        scanType="progressive">
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>


code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MPD mediaPresentationDuration="PT54.915S" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011">
    <Period duration="PT54.915S">
        <AdaptationSet segmentAlignment="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
            <Representation bandwidth="804261" codecs="avc1.4d401e" frameRate="30" height="360" id="VIDEO-1" mimeType="video/mp4" startWithSAP="1" width="360">
                <BaseURL>DASH_360</BaseURL>
                <SegmentBase indexRange="915-1114" indexRangeExact="true">
                    <Initialization range="0-914"/>
                </SegmentBase>
            </Representation>
            <Representation bandwidth="608000" codecs="avc1.4d401e" frameRate="30" height="240" id="VIDEO-2" mimeType="video/mp4" startWithSAP="1" width="240">
                <BaseURL>DASH_240</BaseURL>
                <SegmentBase indexRange="913-1112" indexRangeExact="true">
                    <Initialization range="0-912"/>
                </SegmentBase>
            </Representation>
        </AdaptationSet>
        <AdaptationSet>
            <Representation audioSamplingRate="48000" bandwidth="129870" codecs="mp4a.40.2" id="AUDIO-1" mimeType="audio/mp4" startWithSAP="1">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
                <BaseURL>audio</BaseURL>
                <SegmentBase indexRange="832-1007" indexRangeExact="true">
                    <Initialization range="0-831"/>
                </SegmentBase>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>


code:
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
    <date>2018-03-09T18:01:43Z</date>
    <trackList>
        <track>
            <location>cd1/track%201.mp3</location>
            <title>Pandemonium</title>
            <creator>Foilverb</creator>
            <annotation>Visit http://bigbrother404.bandcamp.com</annotation>
            <album>Pandemonium EP</album>
            <trackNum>1</trackNum>
            <duration>202416</duration>
        </track>
        <track>
            <location>../%E3%83%88%E3%83%A9%E3%83%83%E3%82%AF%E3%80%80%EF%BC%92.mp3</location>
            <title>Final Cartridge (Nichico Twelve Remix)</title>
            <annotation>Visit http://bigbrother404.bandcamp.com</annotation>
            <creator>Foilverb</creator>
            <album>Pandemonium EP</album>
            <trackNum>2</trackNum>
            <duration>255857</duration>
        </track>
        <track>
            <location>track3.mp3</location>
            <location>https://example.com/track3.mp3</location>
            <title>Rebuilding Nightingale</title>
            <annotation>Visit http://bigbrother404.bandcamp.com</annotation>
            <creator>Foilverb</creator>
            <album>Pandemonium EP</album>
            <trackNum>3</trackNum>
            <duration>287915</duration>
        </track>
    </trackList>
</playlist>


code: @py -bb -Werror -Xdev "%~dp0yt_dlp\__main__.py" %*