[wistia] Add duration and modernize

pull/3146/head
Sergey M․ 11 years ago
parent 60b2dd1285
commit e423e0baaa

@ -1,3 +1,5 @@
from __future__ import unicode_literals
import json import json
import re import re
@ -5,14 +7,16 @@ from .common import InfoExtractor
class WistiaIE(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 = { _TEST = {
u"url": u"http://fast.wistia.net/embed/iframe/sh7fpupwlt", 'url': 'http://fast.wistia.net/embed/iframe/sh7fpupwlt',
u"file": u"sh7fpupwlt.mov", 'md5': 'cafeb56ec0c53c18c97405eecb3133df',
u"md5": u"cafeb56ec0c53c18c97405eecb3133df", 'info_dict': {
u"info_dict": { 'id': 'sh7fpupwlt',
u"title": u"cfh_resourceful_zdkh_final_1" 'ext': 'mov',
'title': 'Being Resourceful',
'duration': 117,
}, },
} }
@ -22,7 +26,7 @@ class WistiaIE(InfoExtractor):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
data_json = self._html_search_regex( data_json = self._html_search_regex(
r'Wistia.iframeInit\((.*?), {}\);', webpage, u'video data') r'Wistia\.iframeInit\((.*?), {}\);', webpage, 'video data')
data = json.loads(data_json) data = json.loads(data_json)
@ -54,4 +58,5 @@ class WistiaIE(InfoExtractor):
'title': data['name'], 'title': data['name'],
'formats': formats, 'formats': formats,
'thumbnails': thumbnails, 'thumbnails': thumbnails,
'duration': data.get('duration'),
} }

Loading…
Cancel
Save