1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-06-30 11:02:54 -05:00

[outtmpl] Add operator & for replacement text (#2012)

Authored by: PilzAdam
This commit is contained in:
PilzAdam
2021-12-17 21:35:48 +01:00
committed by GitHub
parent ec2e44fc57
commit e978789f0f
3 changed files with 16 additions and 4 deletions

View File

@ -836,6 +836,11 @@ class TestYoutubeDL(unittest.TestCase):
test('%(title3)s', ('foo/bar\\test', 'foo_bar_test'))
test('folder/%(title3)s', ('folder/foo/bar\\test', 'folder%sfoo_bar_test' % os.path.sep))
# Replacement
test('%(id&foo)s.bar', 'foo.bar')
test('%(title&foo)s.bar', 'NA.bar')
test('%(title&foo|baz)s.bar', 'baz.bar')
def test_format_note(self):
ydl = YoutubeDL()
self.assertEqual(ydl._format_note({}), '')