summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2014-06-24 19:34:39 +0700
committerSergey M․ <dstftw@gmail.com>2014-06-24 19:34:39 +0700
commite423e0baaabe16e80af693d1f05ffc560747b3b8 (patch)
treedee133b0d65b4584a59e47b5bae4164ebdfa6601
parent60b2dd1285a7aeb848e0f3c24f5e9480f9cef616 (diff)
downloadyoutube-dl-e423e0baaabe16e80af693d1f05ffc560747b3b8.tar.gz
youtube-dl-e423e0baaabe16e80af693d1f05ffc560747b3b8.tar.xz
youtube-dl-e423e0baaabe16e80af693d1f05ffc560747b3b8.zip
[wistia] Add duration and modernize
-rw-r--r--youtube_dl/extractor/wistia.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/youtube_dl/extractor/wistia.py b/youtube_dl/extractor/wistia.py
index bc31c2e64..e6bfa9e14 100644
--- a/youtube_dl/extractor/wistia.py
+++ b/youtube_dl/extractor/wistia.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
 import json
 import re
 
@@ -5,14 +7,16 @@ from .common import InfoExtractor
 
 
 class WistiaIE(InfoExtractor):
-    _VALID_URL = r'^https?://(?:fast\.)?wistia\.net/embed/iframe/(?P<id>[a-z0-9]+)'
+    _VALID_URL = r'https?://(?:fast\.)?wistia\.net/embed/iframe/(?P<id>[a-z0-9]+)'
 
     _TEST = {
-        u"url": u"http://fast.wistia.net/embed/iframe/sh7fpupwlt",
-        u"file": u"sh7fpupwlt.mov",
-        u"md5": u"cafeb56ec0c53c18c97405eecb3133df",
-        u"info_dict": {
-            u"title": u"cfh_resourceful_zdkh_final_1"
+        'url': 'http://fast.wistia.net/embed/iframe/sh7fpupwlt',
+        'md5': 'cafeb56ec0c53c18c97405eecb3133df',
+        'info_dict': {
+            'id': 'sh7fpupwlt',
+            'ext': 'mov',
+            'title': 'Being Resourceful',
+            'duration': 117,
         },
     }
 
@@ -22,7 +26,7 @@ class WistiaIE(InfoExtractor):
 
         webpage = self._download_webpage(url, video_id)
         data_json = self._html_search_regex(
-            r'Wistia.iframeInit\((.*?), {}\);', webpage, u'video data')
+            r'Wistia\.iframeInit\((.*?), {}\);', webpage, 'video data')
 
         data = json.loads(data_json)
 
@@ -54,4 +58,5 @@ class WistiaIE(InfoExtractor):
             'title': data['name'],
             'formats': formats,
             'thumbnails': thumbnails,
+            'duration': data.get('duration'),
         }