aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-02-03 07:44:37 +0530
committerdirkf <fieldhouse@gmx.net>2022-02-04 11:09:18 +0000
commit0c0876f790c78c38ececbc920073e8b6cf01e9c7 (patch)
tree938e606bdc63367a79ce0c8ac4de220b2ea4ef69 /youtube_dl
parent7a497f1405ecdcd76c671c7bfaad238d75d01639 (diff)
downloadyoutube-dl-0c0876f790c78c38ececbc920073e8b6cf01e9c7.tar.xz
[youtube:search] Add tests
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/youtube.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 3ab60960a..41695a561 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -3206,7 +3206,14 @@ class YoutubeSearchIE(SearchInfoExtractor, YoutubeBaseInfoExtractor):
_SEARCH_KEY = 'ytsearch'
_SEARCH_PARAMS = 'EgIQAQ%3D%3D' # Videos only
_MAX_RESULTS = float('inf')
- _TESTS = []
+ _TESTS = [{
+ 'url': 'ytsearch10:youtube-dl test video',
+ 'playlist_count': 10,
+ 'info_dict': {
+ 'id': 'youtube-dl test video',
+ 'title': 'youtube-dl test video',
+ }
+ }]
def _get_n_results(self, query, n):
"""Get a specified number of results for a query"""
@@ -3219,7 +3226,14 @@ class YoutubeSearchDateIE(YoutubeSearchIE):
_SEARCH_KEY = 'ytsearchdate'
IE_DESC = 'YouTube.com searches, newest videos first'
_SEARCH_PARAMS = 'CAISAhAB' # Videos only, sorted by date
- _TESTS = []
+ _TESTS = [{
+ 'url': 'ytsearchdate10:youtube-dl test video',
+ 'playlist_count': 10,
+ 'info_dict': {
+ 'id': 'youtube-dl test video',
+ 'title': 'youtube-dl test video',
+ }
+ }]
class YoutubeSearchURLIE(YoutubeBaseInfoExtractor):
@@ -3232,7 +3246,8 @@ class YoutubeSearchURLIE(YoutubeBaseInfoExtractor):
'info_dict': {
'id': 'youtube-dl test video',
'title': 'youtube-dl test video',
- }
+ },
+ 'params': {'playlistend': 5}
}, {
'url': 'https://www.youtube.com/results?q=test&sp=EgQIBBgB',
'only_matching': True,