[youtube:searchurl] Extend _VALID_URL
authorSergey M․ <dstftw@gmail.com>
Mon, 15 Feb 2016 18:29:51 +0000 (00:29 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 15 Feb 2016 18:29:51 +0000 (00:29 +0600)
youtube_dl/extractor/youtube.py

index 18f7d37f44986f40812b0a1255d928caa8a6acf0..45ad881520e27e2e860c761ad635196306d3995d 100644 (file)
@@ -1912,13 +1912,16 @@ class YoutubeSearchDateIE(YoutubeSearchIE):
 class YoutubeSearchURLIE(InfoExtractor):
     IE_DESC = 'YouTube.com search URLs'
     IE_NAME = 'youtube:search_url'
-    _VALID_URL = r'https?://(?:www\.)?youtube\.com/results\?(.*?&)?search_query=(?P<query>[^&]+)(?:[&]|$)'
+    _VALID_URL = r'https?://(?:www\.)?youtube\.com/results\?(.*?&)?(?:search_query|q)=(?P<query>[^&]+)(?:[&]|$)'
     _TESTS = [{
         'url': 'https://www.youtube.com/results?baz=bar&search_query=youtube-dl+test+video&filters=video&lclk=video',
         'playlist_mincount': 5,
         'info_dict': {
             'title': 'youtube-dl test video',
         }
+    }, {
+        'url': 'https://www.youtube.com/results?q=test&sp=EgQIBBgB',
+        'only_matching': True,
     }]
 
     def _real_extract(self, url):