[generic] Abort if user passes in URL "url" (#2942)
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 19 May 2014 15:10:11 +0000 (17:10 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 19 May 2014 15:10:11 +0000 (17:10 +0200)
youtube_dl/extractor/generic.py

index 0e5cf0efbd0867e0daeb06992e561eefc5262326..38a357d3b0406906144e25cbbc45fbe74d2f6c2c 100644 (file)
@@ -363,8 +363,13 @@ class GenericIE(InfoExtractor):
                     return self.url_result('http://' + url)
                 else:
                     if default_search == 'auto_warning':
-                        self._downloader.report_warning(
-                            'Falling back to youtube search for  %s . Set --default-search to "auto" to suppress this warning.' % url)
+                        if re.match(r'^(?:url|URL)$', url):
+                            raise ExtractorError(
+                                'Invalid URL:  %r . Call youtube-dl like this:  youtube-dl -v "https://www.youtube.com/watch?v=BaW_jenozKc"  ' % url,
+                                expected=True)
+                        else:
+                            self._downloader.report_warning(
+                                'Falling back to youtube search for  %s . Set --default-search to "auto" to suppress this warning.' % url)
                     return self.url_result('ytsearch:' + url)
             else:
                 assert ':' in default_search