3 from .common
import InfoExtractor
13 class DigitallySpeakingIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:s?evt\.dispeak|events\.digitallyspeaking)\.com/(?:[^/]+/)+xml/(?P<id>[^.]+)\.xml'
17 # From http://gdcvault.com/play/1023460/Tenacious-Design-and-The-Interface
18 'url': 'http://evt.dispeak.com/ubm/gdc/sf16/xml/840376_BQRC.xml',
19 'md5': 'a8efb6c31ed06ca8739294960b2dbabd',
23 'title': 'Tenacious Design and The Interface of \'Destiny\'',
26 # From http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC
27 'url': 'http://events.digitallyspeaking.com/gdc/sf11/xml/12396_1299111843500GMPX.xml',
28 'only_matching': True,
30 # From http://www.gdcvault.com/play/1013700/Advanced-Material
31 'url': 'http://sevt.dispeak.com/ubm/gdc/eur10/xml/11256_1282118587281VNIT.xml',
32 'only_matching': True,
34 # From https://gdcvault.com/play/1016624, empty speakerVideo
35 'url': 'https://sevt.dispeak.com/ubm/gdc/online12/xml/201210-822101_1349794556671DDDD.xml',
37 'id': '201210-822101_1349794556671DDDD',
39 'title': 'Pre-launch - Preparing to Take the Plunge',
42 # From http://www.gdcvault.com/play/1014846/Conference-Keynote-Shigeru, empty slideVideo
43 'url': 'http://events.digitallyspeaking.com/gdc/project25/xml/p25-miyamoto1999_1282467389849HSVB.xml',
44 'only_matching': True,
47 def _parse_mp4(self
, metadata
):
51 mp4_video
= xpath_text(metadata
, './mp4video', default
=None)
52 if mp4_video
is not None:
53 mobj
= re
.match(r
'(?P<root>https?://.*?/).*', mp4_video
)
54 video_root
= mobj
.group('root')
55 if video_root
is None:
56 http_host
= xpath_text(metadata
, 'httpHost', default
=None)
58 video_root
= f
'http://{http_host}/'
59 if video_root
is None:
60 # Hard-coded in http://evt.dispeak.com/ubm/gdc/sf16/custom/player2.js
61 # Works for GPUTechConf, too
62 video_root
= 'http://s3-2u.digitallyspeaking.com/'
64 formats
= metadata
.findall('./MBRVideos/MBRVideo')
67 for a_format
in formats
:
68 stream_name
= xpath_text(a_format
, 'streamName', fatal
=True)
69 video_path
= re
.match(r
'mp4\:(?P<path>.*)', stream_name
).group('path')
70 url
= video_root
+ video_path
71 bitrate
= xpath_text(a_format
, 'bitrate')
72 tbr
= int_or_none(bitrate
)
73 vbr
= int_or_none(self
._search
_regex
(
74 r
'-(\d+)\.mp4', video_path
, 'vbr', default
=None))
75 video_formats
.append({
83 def _parse_flv(self
, metadata
):
85 akamai_url
= xpath_text(metadata
, './akamaiHost', fatal
=True)
86 audios
= metadata
.findall('./audios/audio')
89 'url': f
'rtmp://{akamai_url}/ondemand?ovpfv=1.1',
90 'play_path': remove_end(audio
.get('url'), '.flv'),
94 'format_id': audio
.get('code'),
96 for video_key
, format_id
, preference
in (
97 ('slide', 'slides', -2), ('speaker', 'speaker', -1)):
98 video_path
= xpath_text(metadata
, f
'./{video_key}Video')
102 'url': f
'rtmp://{akamai_url}/ondemand?ovpfv=1.1',
103 'play_path': remove_end(video_path
, '.flv'),
105 'format_note': f
'{video_key} video',
106 'quality': preference
,
107 'format_id': format_id
,
111 def _real_extract(self
, url
):
112 video_id
= self
._match
_id
(url
)
114 xml_description
= self
._download
_xml
(url
, video_id
)
115 metadata
= xpath_element(xml_description
, 'metadata')
117 video_formats
= self
._parse
_mp
4(metadata
)
118 if video_formats
is None:
119 video_formats
= self
._parse
_flv
(metadata
)
123 'formats': video_formats
,
124 'title': xpath_text(metadata
, 'title', fatal
=True),
125 'duration': parse_duration(xpath_text(metadata
, 'endTime')),
126 'creator': xpath_text(metadata
, 'speaker'),