diff options
author | Philipp Hagemeister <[email protected]> | 2014-03-04 03:32:28 +0100 |
---|---|---|
committer | Philipp Hagemeister <[email protected]> | 2014-03-04 03:32:28 +0100 |
commit | c9ae7b95659df18a296752f31162e57d29777a80 (patch) | |
tree | 38134be9e17934b41849e69872479201761f97c3 /test | |
parent | 86fb4347f7decdc2c6e58a4ec4cb14986536ea67 (diff) | |
download | youtube-dl-c9ae7b95659df18a296752f31162e57d29777a80.tar.gz youtube-dl-c9ae7b95659df18a296752f31162e57d29777a80.zip |
[youtube] Add support for search result URLs (Fixes #2495)
Diffstat (limited to 'test')
-rw-r--r-- | test/test_all_urls.py | 4 | ||||
-rw-r--r-- | test/test_youtube_lists.py | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/test/test_all_urls.py b/test/test_all_urls.py index 7a78005a3..5c17a39fb 100644 --- a/test/test_all_urls.py +++ b/test/test_all_urls.py @@ -71,6 +71,10 @@ class TestAllURLsMatching(unittest.TestCase): def test_youtube_truncated(self): self.assertMatch('http://www.youtube.com/watch?', ['youtube:truncated_url']) + def test_youtube_search_matching(self): + self.assertMatch('http://www.youtube.com/results?search_query=making+mustard', ['youtube:search_url']) + self.assertMatch('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video', ['youtube:search_url']) + def test_justin_tv_channelid_matching(self): self.assertTrue(JustinTVIE.suitable(u"justin.tv/vanillatv")) self.assertTrue(JustinTVIE.suitable(u"twitch.tv/vanillatv")) diff --git a/test/test_youtube_lists.py b/test/test_youtube_lists.py index 5eccc11ff..7d3b9c705 100644 --- a/test/test_youtube_lists.py +++ b/test/test_youtube_lists.py @@ -16,6 +16,7 @@ from youtube_dl.extractor import ( YoutubeChannelIE, YoutubeShowIE, YoutubeTopListIE, + YoutubeSearchURLIE, ) @@ -133,5 +134,14 @@ class TestYoutubeLists(unittest.TestCase): entries = result['entries'] self.assertTrue(len(entries) >= 5) + def test_youtube_search_url(self): + dl = FakeYDL() + ie = YoutubeSearchURLIE(dl) + result = ie.extract('https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video') + entries = result['entries'] + self.assertIsPlaylist(result) + self.assertEqual(result['title'], 'youtube-dl test video') + self.assertTrue(len(entries) >= 5) + if __name__ == '__main__': unittest.main() |