]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/dispeak.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
15 class DigitallySpeakingIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:s?evt\.dispeak|events\.digitallyspeaking)\.com/(?:[^/]+/)+xml/(?P<id>[^.]+)\.xml'
19 # From http://gdcvault.com/play/1023460/Tenacious-Design-and-The-Interface
20 'url': 'http://evt.dispeak.com/ubm/gdc/sf16/xml/840376_BQRC.xml',
21 'md5': 'a8efb6c31ed06ca8739294960b2dbabd',
25 'title': 'Tenacious Design and The Interface of \'Destiny\'',
28 # From http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC
29 'url': 'http://events.digitallyspeaking.com/gdc/sf11/xml/12396_1299111843500GMPX.xml',
30 'only_matching': True,
32 # From http://www.gdcvault.com/play/1013700/Advanced-Material
33 'url': 'http://sevt.dispeak.com/ubm/gdc/eur10/xml/11256_1282118587281VNIT.xml',
34 'only_matching': True,
36 # From https://gdcvault.com/play/1016624, empty speakerVideo
37 'url': 'https://sevt.dispeak.com/ubm/gdc/online12/xml/201210-822101_1349794556671DDDD.xml',
39 'id': '201210-822101_1349794556671DDDD',
41 'title': 'Pre-launch - Preparing to Take the Plunge',
44 # From http://www.gdcvault.com/play/1014846/Conference-Keynote-Shigeru, empty slideVideo
45 'url': 'http://events.digitallyspeaking.com/gdc/project25/xml/p25-miyamoto1999_1282467389849HSVB.xml',
46 'only_matching': True,
49 def _parse_mp4(self
, metadata
):
53 mp4_video
= xpath_text(metadata
, './mp4video', default
=None)
54 if mp4_video
is not None:
55 mobj
= re
.match(r
'(?P<root>https?://.*?/).*', mp4_video
)
56 video_root
= mobj
.group('root')
57 if video_root
is None:
58 http_host
= xpath_text(metadata
, 'httpHost', default
=None)
60 video_root
= 'http://%s/' % http_host
61 if video_root
is None:
62 # Hard-coded in http://evt.dispeak.com/ubm/gdc/sf16/custom/player2.js
63 # Works for GPUTechConf, too
64 video_root
= 'http://s3-2u.digitallyspeaking.com/'
66 formats
= metadata
.findall('./MBRVideos/MBRVideo')
69 for a_format
in formats
:
70 stream_name
= xpath_text(a_format
, 'streamName', fatal
=True)
71 video_path
= re
.match(r
'mp4\:(?P<path>.*)', stream_name
).group('path')
72 url
= video_root
+ video_path
73 bitrate
= xpath_text(a_format
, 'bitrate')
74 tbr
= int_or_none(bitrate
)
75 vbr
= int_or_none(self
._search
_regex
(
76 r
'-(\d+)\.mp4', video_path
, 'vbr', default
=None))
77 video_formats
.append({
85 def _parse_flv(self
, metadata
):
87 akamai_url
= xpath_text(metadata
, './akamaiHost', fatal
=True)
88 audios
= metadata
.findall('./audios/audio')
91 'url': 'rtmp://%s/ondemand?ovpfv=1.1' % akamai_url
,
92 'play_path': remove_end(audio
.get('url'), '.flv'),
96 'format_id': audio
.get('code'),
98 for video_key
, format_id
, preference
in (
99 ('slide', 'slides', -2), ('speaker', 'speaker', -1)):
100 video_path
= xpath_text(metadata
, './%sVideo' % video_key
)
104 'url': 'rtmp://%s/ondemand?ovpfv=1.1' % akamai_url
,
105 'play_path': remove_end(video_path
, '.flv'),
107 'format_note': '%s video' % video_key
,
108 'quality': preference
,
109 'format_id': format_id
,
113 def _real_extract(self
, url
):
114 video_id
= self
._match
_id
(url
)
116 xml_description
= self
._download
_xml
(url
, video_id
)
117 metadata
= xpath_element(xml_description
, 'metadata')
119 video_formats
= self
._parse
_mp
4(metadata
)
120 if video_formats
is None:
121 video_formats
= self
._parse
_flv
(metadata
)
122 self
._sort
_formats
(video_formats
)
126 'formats': video_formats
,
127 'title': xpath_text(metadata
, 'title', fatal
=True),
128 'duration': parse_duration(xpath_text(metadata
, 'endTime')),
129 'creator': xpath_text(metadata
, 'speaker'),