Allow _TESTS attribute for IEs with multiple tests
[youtube-dl] / youtube_dl / extractor / youtube.py
index c7922c533343ca162c922659d34dc867d6839864..def6f7a74e951882403deff45603a214924ba9a8 100644 (file)
@@ -81,6 +81,44 @@ class YoutubeIE(InfoExtractor):
         '46': '1080x1920',
     }
     IE_NAME = u'youtube'
+    _TESTS = [
+        {
+            "url":  "http://www.youtube.com/watch?v=BaW_jenozKc",
+            "file":  "BaW_jenozKc.mp4",
+            "info_dict": {
+              "title": "youtube-dl test video \"'/\\ä↭𝕐",
+              "uploader": "Philipp Hagemeister",
+              "uploader_id": "phihag",
+              "upload_date": "20121002",
+              "description": "test chars:  \"'/\\ä↭𝕐\n\nThis is a test video for youtube-dl.\n\nFor more information, contact phihag@phihag.de ."
+            }
+          },
+          {
+            "url":  "http://www.youtube.com/watch?v=1ltcDfZMA3U",
+            "file":  "1ltcDfZMA3U.flv",
+            "note": "Test VEVO video (#897)",
+            "info_dict": {
+              "upload_date": "20070518",
+              "title": "Maps - It Will Find You",
+              "description": "Music video by Maps performing It Will Find You.",
+              "uploader": "MuteUSA",
+              "uploader_id": "MuteUSA"
+            }
+          },
+          {
+            "url":  "http://www.youtube.com/watch?v=UxxajLWwzqY",
+            "file":  "UxxajLWwzqY.mp4",
+            "note": "Test generic use_cipher_signature video (#897)",
+            "info_dict": {
+              "upload_date": "20120506",
+              "title": "Icona Pop - I Love It (feat. Charli XCX) [OFFICIAL VIDEO]",
+              "description": "md5:b085c9804f5ab69f4adea963a2dceb3c",
+              "uploader": "IconaPop",
+              "uploader_id": "IconaPop"
+            }
+          }
+    ]
+
 
     @classmethod
     def suitable(cls, url):
@@ -130,7 +168,7 @@ class YoutubeIE(InfoExtractor):
         self.to_screen(u'RTMP download detected')
 
     def _decrypt_signature(self, s):
-        """Decrypt the key the two subkeys must have a length of 43"""
+        """Decrypt the key"""
 
         if len(s) == 88:
             return s[48] + s[81:67:-1] + s[82] + s[66:62:-1] + s[85] + s[61:48:-1] + s[67] + s[47:12:-1] + s[3] + s[11:3:-1] + s[2] + s[12]
@@ -148,7 +186,7 @@ class YoutubeIE(InfoExtractor):
             return s[36] + s[79:67:-1] + s[81] + s[66:40:-1] + s[33] + s[39:36:-1] + s[40] + s[35] + s[0] + s[67] + s[32:0:-1] + s[34]
 
         else:
-            raise ExtractorError(u'Unable to decrypt signature, subkeys length %d not supported; retrying might work' % (len(s)))
+            raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s)))
 
     def _get_available_subtitles(self, video_id):
         self.report_video_subtitles_download(video_id)