[dispeak/gdcvault] Add the test case from #5784
authorYen Chi Hsuan <yan12125@gmail.com>
Thu, 21 Apr 2016 11:46:32 +0000 (19:46 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Thu, 21 Apr 2016 11:47:10 +0000 (19:47 +0800)
youtube_dl/extractor/dispeak.py
youtube_dl/extractor/gdcvault.py

index 6ebc3255a1d567f6aebd3b38fea25c2d4a499271..c74fa7e0725bbe94cb1980695585889bedeffab4 100644 (file)
@@ -13,9 +13,9 @@ from ..utils import (
 
 
 class DigitalSpeakingIE(InfoExtractor):
-    _VALID_URL = r'http://evt.dispeak.com/([^/]+/)+xml/(?P<id>[^.]+).xml'
+    _VALID_URL = r'http://(?:evt\.dispeak|events\.digitallyspeaking)\.com/([^/]+/)+xml/(?P<id>[^.]+).xml'
 
-    _TEST = {
+    _TESTS = [{
         # From http://evt.dispeak.com/ubm/gdc/sf16/xml/840376_BQRC.xml
         'url': 'http://evt.dispeak.com/ubm/gdc/sf16/xml/840376_BQRC.xml',
         'md5': 'a8efb6c31ed06ca8739294960b2dbabd',
@@ -24,7 +24,11 @@ class DigitalSpeakingIE(InfoExtractor):
             'ext': 'mp4',
             'title': 'Tenacious Design and The Interface of \'Destiny\'',
         },
-    }
+    }, {
+        # From http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC
+        'url': 'http://events.digitallyspeaking.com/gdc/sf11/xml/12396_1299111843500GMPX.xml',
+        'only_matching': True,
+    }]
 
     def _parse_mp4(self, metadata):
         video_formats = []
@@ -60,16 +64,15 @@ class DigitalSpeakingIE(InfoExtractor):
     def _parse_flv(self, metadata):
         formats = []
         akamai_url = xpath_text(metadata, './akamaiHost', fatal=True)
-        audios = metadata.find('./audios')
-        if audios is not None:
-            for audio in audios:
-                formats.append({
-                    'url': 'rtmp://%s/ondemand?ovpfv=1.1' % akamai_url,
-                    'play_path': remove_end(audio.get('url'), '.flv'),
-                    'ext': 'flv',
-                    'vcodec': 'none',
-                    'format_id': audio.get('code'),
-                })
+        audios = metadata.findall('./audios/audio')
+        for audio in audios:
+            formats.append({
+                'url': 'rtmp://%s/ondemand?ovpfv=1.1' % akamai_url,
+                'play_path': remove_end(audio.get('url'), '.flv'),
+                'ext': 'flv',
+                'vcodec': 'none',
+                'format_id': audio.get('code'),
+            })
         slide_video_path = xpath_text(metadata, './slideVideo', fatal=True)
         formats.append({
             'url': 'rtmp://%s/ondemand?ovpfv=1.1' % akamai_url,
index 01e1ceec8e212c13e7f86a15ba7a161755ff8ad2..5d45faf859dcbf14cf361ab36758dc9eee851063 100644 (file)
@@ -52,6 +52,7 @@ class GDCVaultIE(InfoExtractor):
             'only_matching': True,
         },
         {
+            # Hard-coded hostname
             'url': 'http://gdcvault.com/play/1023460/Tenacious-Design-and-The-Interface',
             'md5': 'a8efb6c31ed06ca8739294960b2dbabd',
             'info_dict': {
@@ -61,6 +62,19 @@ class GDCVaultIE(InfoExtractor):
                 'title': 'Tenacious Design and The Interface of \'Destiny\'',
             },
         },
+        {
+            # Multiple audios
+            'url': 'http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC',
+            'info_dict': {
+                'id': '1014631',
+                'ext': 'flv',
+                'title': 'How to Create a Good Game - From My Experience of Designing Pac-Man',
+            },
+            'params': {
+                'skip_download': True,  # Requires rtmpdump
+                'format': 'jp',  # The japanese audio
+            }
+        },
     ]
 
     def _login(self, webpage_url, display_id):