diff options
author | Remita Amine <remitamine@gmail.com> | 2021-01-04 00:51:55 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2021-01-04 01:14:25 +0100 |
commit | e88c9ef62a4a26cc77370b741a4244d298c7d45a (patch) | |
tree | 1a51cee08f0515853f9c5661a8098f89d5a43668 /test | |
parent | 0889eb33e0d40d567be5b2f8431952a5517276fc (diff) |
[utils] add a function to clean podcast URLs
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index d49d3239c..259c4763e 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -21,6 +21,7 @@ from youtube_dl.utils import ( encode_base_n, caesar, clean_html, + clean_podcast_url, date_from_str, DateRange, detect_exe_version, @@ -1470,6 +1471,10 @@ Line 1 self.assertEqual(get_elements_by_attribute('class', 'foo', html), []) self.assertEqual(get_elements_by_attribute('class', 'no-such-foo', html), []) + def test_clean_podcast_url(self): + self.assertEqual(clean_podcast_url('https://www.podtrac.com/pts/redirect.mp3/chtbl.com/track/5899E/traffic.megaphone.fm/HSW7835899191.mp3'), 'https://traffic.megaphone.fm/HSW7835899191.mp3') + self.assertEqual(clean_podcast_url('https://play.podtrac.com/npr-344098539/edge1.pod.npr.org/anon.npr-podcasts/podcast/npr/waitwait/2020/10/20201003_waitwait_wwdtmpodcast201003-015621a5-f035-4eca-a9a1-7c118d90bc3c.mp3'), 'https://edge1.pod.npr.org/anon.npr-podcasts/podcast/npr/waitwait/2020/10/20201003_waitwait_wwdtmpodcast201003-015621a5-f035-4eca-a9a1-7c118d90bc3c.mp3') + if __name__ == '__main__': unittest.main() |