Exemplo n.º 1
0
 def test_contains_banned_keywords_positive(self):
     html_string = self.get_resource_contents(k_VIDEO_HTML)
     v = Video(video_id='fake_id_123')
     v._html = VideoHTMLParser(html_string=html_string)
     contains = download_thread._title_contains_keywords(video=v,
                                                         keywords=['そう'])
     self.assertTrue(contains, 'The title contains the banned keyword')
Exemplo n.º 2
0
 def test_title_transformation(self):
     p = VideoHTMLParser(html_string=self.get_resource_contents(k_VIDEO_WITH_ILLEGAL_TITLE))
     v = Video(video_id='sm')
     v._html = p
     params = custom_youtube_dl.get_ydl_options(video=v)
     self.assertTrue('-%' in params['outtmpl'], "'-%' should be in 'outtmpl'")
     self.assertFalse('%(title)s' in params['outtmpl'], "'%(title)s' should not be in 'outtmpl'")
Exemplo n.º 3
0
 def test_contains_banned_keywords_negative(self):
     html_string = self.get_resource_contents(k_VIDEO_HTML)
     v = Video(video_id='fake_id_123')
     v._html = VideoHTMLParser(html_string=html_string)
     contains = download_thread._title_contains_keywords(
         video=v, keywords=['keyword1', 'keyword2'])
     self.assertFalse(contains,
                      'The title does not contain the banned keyword')