]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/gdcvault.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from .kaltura
import KalturaIE
16 class GDCVaultIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)(?:/(?P<name>[\w-]+))?'
18 _NETRC_MACHINE
= 'gdcvault'
21 'url': 'http://www.gdcvault.com/play/1019721/Doki-Doki-Universe-Sweet-Simple',
22 'md5': '7ce8388f544c88b7ac11c7ab1b593704',
24 'id': '201311826596_AWNY',
25 'display_id': 'Doki-Doki-Universe-Sweet-Simple',
27 'title': 'Doki-Doki Universe: Sweet, Simple and Genuine (GDC Next 10)'
31 'url': 'http://www.gdcvault.com/play/1015683/Embracing-the-Dark-Art-of',
33 'id': '201203272_1330951438328RSXR',
34 'display_id': 'Embracing-the-Dark-Art-of',
36 'title': 'Embracing the Dark Art of Mathematical Modeling in AI'
39 'skip_download': True, # Requires rtmpdump
43 'url': 'http://www.gdcvault.com/play/1015301/Thexder-Meets-Windows-95-or',
44 'md5': 'a5eb77996ef82118afbbe8e48731b98e',
47 'display_id': 'Thexder-Meets-Windows-95-or',
49 'title': 'Thexder Meets Windows 95, or Writing Great Games in the Windows 95 Environment',
51 'skip': 'Requires login',
54 'url': 'http://gdcvault.com/play/1020791/',
55 'only_matching': True,
59 'url': 'http://gdcvault.com/play/1023460/Tenacious-Design-and-The-Interface',
60 'md5': 'a8efb6c31ed06ca8739294960b2dbabd',
64 'display_id': 'Tenacious-Design-and-The-Interface',
65 'title': 'Tenacious Design and The Interface of \'Destiny\'',
70 'url': 'http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC',
72 'id': '12396_1299111843500GMPX',
74 'title': 'How to Create a Good Game - From My Experience of Designing Pac-Man',
77 # 'skip_download': True, # Requires rtmpdump
78 # 'format': 'jp', # The japanese audio
83 'url': 'http://www.gdcvault.com/play/1435/An-American-engine-in-Tokyo',
85 'id': '9350_1238021887562UHXB',
86 'display_id': 'An-American-engine-in-Tokyo',
88 'title': 'An American Engine in Tokyo:/nThe collaboration of Epic Games and Square Enix/nFor THE LAST REMINANT',
93 'url': 'https://www.gdcvault.com/play/1026180/Mastering-the-Apex-of-Scaling',
97 'title': 'Mastering the Apex of Scaling Game Servers (Presented by Multiplay)',
98 'timestamp': 1554401811,
99 'upload_date': '20190404',
100 'uploader_id': 'joe@blazestreaming.com',
107 # Kaltura embed, whitespace between quote and embedded URL in iframe's src
108 'url': 'https://www.gdcvault.com/play/1025699',
112 'title': 'Tech Toolbox',
113 'upload_date': '20190408',
114 'uploader_id': 'joe@blazestreaming.com',
115 'timestamp': 1554764629,
118 'skip_download': True,
123 'url': 'http://www.gdcvault.com/play/1014846/Conference-Keynote-Shigeru',
124 'only_matching': True,
128 def _login(self
, webpage_url
, display_id
):
129 username
, password
= self
._get
_login
_info
()
130 if username
is None or password
is None:
131 self
.report_warning('It looks like ' + webpage_url
+ ' requires a login. Try specifying a username and password and try again.')
134 mobj
= re
.match(r
'(?P<root_url>https?://.*?/).*', webpage_url
)
135 login_url
= mobj
.group('root_url') + 'api/login.php'
136 logout_url
= mobj
.group('root_url') + 'logout'
140 'password': password
,
143 request
= sanitized_Request(login_url
, urlencode_postdata(login_form
))
144 request
.add_header('Content-Type', 'application/x-www-form-urlencoded')
145 self
._download
_webpage
(request
, display_id
, 'Logging in')
146 start_page
= self
._download
_webpage
(webpage_url
, display_id
, 'Getting authenticated video page')
147 self
._download
_webpage
(logout_url
, display_id
, 'Logging out')
151 def _real_extract(self
, url
):
152 video_id
, name
= re
.match(self
._VALID
_URL
, url
).groups()
153 display_id
= name
or video_id
155 webpage_url
= 'http://www.gdcvault.com/play/' + video_id
156 start_page
= self
._download
_webpage
(webpage_url
, display_id
)
158 direct_url
= self
._search
_regex
(
159 r
's1\.addVariable\("file",\s*encodeURIComponent\("(/[^"]+)"\)\);',
160 start_page
, 'url', default
=None)
162 title
= self
._html
_search
_regex
(
163 r
'<td><strong>Session Name:?</strong></td>\s*<td>(.*?)</td>',
165 video_url
= 'http://www.gdcvault.com' + direct_url
166 # resolve the url so that we can detect the correct extension
167 video_url
= self
._request
_webpage
(
168 HEADRequest(video_url
), video_id
).geturl()
172 'display_id': display_id
,
177 embed_url
= KalturaIE
._extract
_url
(start_page
)
179 embed_url
= smuggle_url(embed_url
, {'source_url': url}
)
182 PLAYER_REGEX
= r
'<iframe src="(?P<xml_root>.+?)/(?:gdc-)?player.*?\.html.*?".*?</iframe>'
184 xml_root
= self
._html
_search
_regex
(
185 PLAYER_REGEX
, start_page
, 'xml root', default
=None)
187 # Probably need to authenticate
188 login_res
= self
._login
(webpage_url
, display_id
)
189 if login_res
is None:
190 self
.report_warning('Could not login.')
192 start_page
= login_res
193 # Grab the url from the authenticated page
194 xml_root
= self
._html
_search
_regex
(
195 PLAYER_REGEX
, start_page
, 'xml root')
197 xml_name
= self
._html
_search
_regex
(
198 r
'<iframe src=".*?\?xml(?:=|URL=xml/)(.+?\.xml).*?".*?</iframe>',
199 start_page
, 'xml filename', default
=None)
201 info
= self
._parse
_html
5_media
_entries
(url
, start_page
, video_id
)[0]
203 'title': remove_start(self
._search
_regex
(
204 r
'>Session Name:\s*<.*?>\s*<td>(.+?)</td>', start_page
,
205 'title', default
=None) or self
._og
_search
_title
(
206 start_page
, default
=None), 'GDC Vault - '),
208 'display_id': display_id
,
211 embed_url
= '%s/xml/%s' % (xml_root
, xml_name
)
212 ie_key
= 'DigitallySpeaking'
215 '_type': 'url_transparent',
217 'display_id': display_id
,