瀏覽代碼

[youtube] Warn if URL is most likely wrong (#969)

Philipp Hagemeister 12 年之前
父節點
當前提交
d7f44b5bdb
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      youtube_dl/extractor/youtube.py

+ 3 - 0
youtube_dl/extractor/youtube.py

@@ -402,6 +402,9 @@ class YoutubeIE(InfoExtractor):
         return video_id
 
     def _real_extract(self, url):
+        if re.match(r'(?:https?://)?[^/]+/watch\?feature=[a-z_]+$', url):
+            self._downloader.report_warning(u'Did you forget to quote the URL? Remember that & is a meta-character in most shells, so you want to put the URL in quotes, like  youtube-dl \'http://www.youtube.com/watch?feature=foo&v=BaW_jenozKc\' (or simply  youtube-dl BaW_jenozKc  ).')
+
         # Extract original video URL from URL with redirection, like age verification, using next_url parameter
         mobj = re.search(self._NEXT_URL_RE, url)
         if mobj: