3 from .common
import InfoExtractor
4 from .kaltura
import KalturaIE
5 from ..networking
import HEADRequest
, Request
6 from ..utils
import remove_start
, smuggle_url
, urlencode_postdata
9 class GDCVaultIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)(?:/(?P<name>[\w-]+))?'
12 _NETRC_MACHINE
= 'gdcvault'
15 'url': 'http://www.gdcvault.com/play/1019721/Doki-Doki-Universe-Sweet-Simple',
16 'md5': '7ce8388f544c88b7ac11c7ab1b593704',
18 'id': '201311826596_AWNY',
19 'display_id': 'Doki-Doki-Universe-Sweet-Simple',
21 'title': 'Doki-Doki Universe: Sweet, Simple and Genuine (GDC Next 10)',
25 'url': 'http://www.gdcvault.com/play/1015683/Embracing-the-Dark-Art-of',
27 'id': '201203272_1330951438328RSXR',
28 'display_id': 'Embracing-the-Dark-Art-of',
30 'title': 'Embracing the Dark Art of Mathematical Modeling in AI',
33 'skip_download': True, # Requires rtmpdump
37 'url': 'http://www.gdcvault.com/play/1015301/Thexder-Meets-Windows-95-or',
38 'md5': 'a5eb77996ef82118afbbe8e48731b98e',
41 'display_id': 'Thexder-Meets-Windows-95-or',
43 'title': 'Thexder Meets Windows 95, or Writing Great Games in the Windows 95 Environment',
45 'skip': 'Requires login',
48 'url': 'http://gdcvault.com/play/1020791/',
49 'only_matching': True,
53 'url': 'http://gdcvault.com/play/1023460/Tenacious-Design-and-The-Interface',
54 'md5': 'a8efb6c31ed06ca8739294960b2dbabd',
58 'display_id': 'Tenacious-Design-and-The-Interface',
59 'title': 'Tenacious Design and The Interface of \'Destiny\'',
64 'url': 'http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC',
66 'id': '12396_1299111843500GMPX',
68 'title': 'How to Create a Good Game - From My Experience of Designing Pac-Man',
71 # 'skip_download': True, # Requires rtmpdump
72 # 'format': 'jp', # The japanese audio
77 'url': 'http://www.gdcvault.com/play/1435/An-American-engine-in-Tokyo',
79 'id': '9350_1238021887562UHXB',
80 'display_id': 'An-American-engine-in-Tokyo',
82 'title': 'An American Engine in Tokyo:/nThe collaboration of Epic Games and Square Enix/nFor THE LAST REMINANT',
87 'url': 'https://www.gdcvault.com/play/1026180/Mastering-the-Apex-of-Scaling',
91 'title': 'Mastering the Apex of Scaling Game Servers (Presented by Multiplay)',
92 'timestamp': 1554401811,
93 'upload_date': '20190404',
94 'uploader_id': 'joe@blazestreaming.com',
101 # Kaltura embed, whitespace between quote and embedded URL in iframe's src
102 'url': 'https://www.gdcvault.com/play/1025699',
106 'title': 'Tech Toolbox',
107 'upload_date': '20190408',
108 'uploader_id': 'joe@blazestreaming.com',
109 'timestamp': 1554764629,
112 'skip_download': True,
117 'url': 'http://www.gdcvault.com/play/1014846/Conference-Keynote-Shigeru',
118 'only_matching': True,
122 def _login(self
, webpage_url
, display_id
):
123 username
, password
= self
._get
_login
_info
()
124 if username
is None or password
is None:
125 self
.report_warning('It looks like ' + webpage_url
+ ' requires a login. Try specifying a username and password and try again.')
128 mobj
= re
.match(r
'(?P<root_url>https?://.*?/).*', webpage_url
)
129 login_url
= mobj
.group('root_url') + 'api/login.php'
130 logout_url
= mobj
.group('root_url') + 'logout'
134 'password': password
,
137 request
= Request(login_url
, urlencode_postdata(login_form
))
138 request
.headers
['Content-Type'] = 'application/x-www-form-urlencoded'
139 self
._download
_webpage
(request
, display_id
, 'Logging in')
140 start_page
= self
._download
_webpage
(webpage_url
, display_id
, 'Getting authenticated video page')
141 self
._download
_webpage
(logout_url
, display_id
, 'Logging out')
145 def _real_extract(self
, url
):
146 video_id
, name
= self
._match
_valid
_url
(url
).groups()
147 display_id
= name
or video_id
149 webpage_url
= 'http://www.gdcvault.com/play/' + video_id
150 start_page
= self
._download
_webpage
(webpage_url
, display_id
)
152 direct_url
= self
._search
_regex
(
153 r
's1\.addVariable\("file",\s*encodeURIComponent\("(/[^"]+)"\)\);',
154 start_page
, 'url', default
=None)
156 title
= self
._html
_search
_regex
(
157 r
'<td><strong>Session Name:?</strong></td>\s*<td>(.*?)</td>',
159 video_url
= 'http://www.gdcvault.com' + direct_url
160 # resolve the url so that we can detect the correct extension
161 video_url
= self
._request
_webpage
(
162 HEADRequest(video_url
), video_id
).url
166 'display_id': display_id
,
171 embed_url
= KalturaIE
._extract
_url
(start_page
)
173 embed_url
= smuggle_url(embed_url
, {'source_url': url
})
176 PLAYER_REGEX
= r
'<iframe src="(?P<xml_root>.+?)/(?:gdc-)?player.*?\.html.*?".*?</iframe>'
178 xml_root
= self
._html
_search
_regex
(
179 PLAYER_REGEX
, start_page
, 'xml root', default
=None)
181 # Probably need to authenticate
182 login_res
= self
._login
(webpage_url
, display_id
)
183 if login_res
is None:
184 self
.report_warning('Could not login.')
186 start_page
= login_res
187 # Grab the url from the authenticated page
188 xml_root
= self
._html
_search
_regex
(
189 PLAYER_REGEX
, start_page
, 'xml root')
191 xml_name
= self
._html
_search
_regex
(
192 r
'<iframe src=".*?\?xml(?:=|URL=xml/)(.+?\.xml).*?".*?</iframe>',
193 start_page
, 'xml filename', default
=None)
195 info
= self
._parse
_html
5_media
_entries
(url
, start_page
, video_id
)[0]
197 'title': remove_start(self
._search
_regex
(
198 r
'>Session Name:\s*<.*?>\s*<td>(.+?)</td>', start_page
,
199 'title', default
=None) or self
._og
_search
_title
(
200 start_page
, default
=None), 'GDC Vault - '),
202 'display_id': display_id
,
205 embed_url
= f
'{xml_root}/xml/{xml_name}'
206 ie_key
= 'DigitallySpeaking'
209 '_type': 'url_transparent',
211 'display_id': display_id
,