From 81474531ff52256d92e9acb30ef0434a1d6c57c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Dor=C3=A9?= Date: Tue, 4 Sep 2018 14:39:31 -0400 Subject: [PATCH] Add PBS extractor subtitle tests --- test/test_subtitles.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/test_subtitles.py b/test/test_subtitles.py index 7d57a628e..64122cce7 100644 --- a/test/test_subtitles.py +++ b/test/test_subtitles.py @@ -28,6 +28,7 @@ from youtube_dl.extractor import ( RTVEALaCartaIE, FunnyOrDieIE, DemocracynowIE, + PBSIE ) @@ -354,5 +355,36 @@ class TestDemocracynowSubtitles(BaseTestSubtitles): self.assertEqual(md5(subtitles['en']), 'acaca989e24a9e45a6719c9b3d60815c') +class TestPBSSubtitles(BaseTestSubtitles): + url = 'https://www.pbs.org/video/how-fantasy-reflects-our-world-picecq/' + IE = PBSIE + + def test_allsubtitles(self): + self.DL.params['writesubtitles'] = True + self.DL.params['allsubtitles'] = True + subtitles = self.getSubtitles() + self.assertEqual(len(subtitles.keys()), 1) + self.assertIn('en', subtitles) + self.assertTrue(len(subtitles['en']) > 20000) + + def test_subtitles_dfxp_format(self): + self.DL.params['writesubtitles'] = True + self.DL.params['subtitlesformat'] = 'dfxp' + subtitles = self.getSubtitles() + self.assertEqual(md5(subtitles['en']), '643b034254cdc3768ff1e750b6b5873b') + + def test_subtitles_vtt_format(self): + self.DL.params['writesubtitles'] = True + self.DL.params['subtitlesformat'] = 'vtt' + subtitles = self.getSubtitles() + self.assertEqual(md5(subtitles['en']), '937a05711555b165d4c55a9667017045') + + def test_subtitles_srt_format(self): + self.DL.params['writesubtitles'] = True + self.DL.params['subtitlesformat'] = 'srt' + subtitles = self.getSubtitles() + self.assertEqual(md5(subtitles['en']), '2082c21b43759d9bf172931b2f2ca371') + + if __name__ == '__main__': unittest.main()