]>
Commit | Line | Data |
---|---|---|
9e68f9fd DW |
1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
9e68f9fd DW |
4 | |
5 | from .common import InfoExtractor | |
118f7add | 6 | from .kaltura import KalturaIE |
44cae2fb | 7 | from ..utils import ( |
5c2266df | 8 | sanitized_Request, |
6e6bc8da | 9 | urlencode_postdata, |
44cae2fb | 10 | ) |
9e68f9fd | 11 | |
5d2519e5 | 12 | |
9e68f9fd | 13 | class GDCVaultIE(InfoExtractor): |
118f7add | 14 | _VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)(?:/(?P<name>[\w-]+))?' |
499bfcbf | 15 | _NETRC_MACHINE = 'gdcvault' |
83cebb8b | 16 | _TESTS = [ |
83cebb8b | 17 | { |
45344855 DW |
18 | 'url': 'http://www.gdcvault.com/play/1019721/Doki-Doki-Universe-Sweet-Simple', |
19 | 'md5': '7ce8388f544c88b7ac11c7ab1b593704', | |
20 | 'info_dict': { | |
118f7add | 21 | 'id': '201311826596_AWNY', |
c8ff6457 | 22 | 'display_id': 'Doki-Doki-Universe-Sweet-Simple', |
45344855 DW |
23 | 'ext': 'mp4', |
24 | 'title': 'Doki-Doki Universe: Sweet, Simple and Genuine (GDC Next 10)' | |
83cebb8b DW |
25 | } |
26 | }, | |
50a138d9 | 27 | { |
45344855 | 28 | 'url': 'http://www.gdcvault.com/play/1015683/Embracing-the-Dark-Art-of', |
45344855 | 29 | 'info_dict': { |
118f7add | 30 | 'id': '201203272_1330951438328RSXR', |
c8ff6457 | 31 | 'display_id': 'Embracing-the-Dark-Art-of', |
45344855 DW |
32 | 'ext': 'flv', |
33 | 'title': 'Embracing the Dark Art of Mathematical Modeling in AI' | |
34 | }, | |
f604c93c PH |
35 | 'params': { |
36 | 'skip_download': True, # Requires rtmpdump | |
50a138d9 DW |
37 | } |
38 | }, | |
5d2519e5 PH |
39 | { |
40 | 'url': 'http://www.gdcvault.com/play/1015301/Thexder-Meets-Windows-95-or', | |
41 | 'md5': 'a5eb77996ef82118afbbe8e48731b98e', | |
42 | 'info_dict': { | |
43 | 'id': '1015301', | |
c8ff6457 | 44 | 'display_id': 'Thexder-Meets-Windows-95-or', |
5d2519e5 PH |
45 | 'ext': 'flv', |
46 | 'title': 'Thexder Meets Windows 95, or Writing Great Games in the Windows 95 Environment', | |
740a7fcb PH |
47 | }, |
48 | 'skip': 'Requires login', | |
25f7d1be YCH |
49 | }, |
50 | { | |
51 | 'url': 'http://gdcvault.com/play/1020791/', | |
52 | 'only_matching': True, | |
99ef96f8 YCH |
53 | }, |
54 | { | |
442c4d36 | 55 | # Hard-coded hostname |
99ef96f8 YCH |
56 | 'url': 'http://gdcvault.com/play/1023460/Tenacious-Design-and-The-Interface', |
57 | 'md5': 'a8efb6c31ed06ca8739294960b2dbabd', | |
58 | 'info_dict': { | |
118f7add | 59 | 'id': '840376_BQRC', |
99ef96f8 YCH |
60 | 'ext': 'mp4', |
61 | 'display_id': 'Tenacious-Design-and-The-Interface', | |
62 | 'title': 'Tenacious Design and The Interface of \'Destiny\'', | |
63 | }, | |
64 | }, | |
442c4d36 YCH |
65 | { |
66 | # Multiple audios | |
67 | 'url': 'http://www.gdcvault.com/play/1014631/Classic-Game-Postmortem-PAC', | |
68 | 'info_dict': { | |
118f7add RA |
69 | 'id': '12396_1299111843500GMPX', |
70 | 'ext': 'mp4', | |
442c4d36 YCH |
71 | 'title': 'How to Create a Good Game - From My Experience of Designing Pac-Man', |
72 | }, | |
118f7add RA |
73 | # 'params': { |
74 | # 'skip_download': True, # Requires rtmpdump | |
75 | # 'format': 'jp', # The japanese audio | |
76 | # } | |
442c4d36 | 77 | }, |
50ad078b YCH |
78 | { |
79 | # gdc-player.html | |
80 | 'url': 'http://www.gdcvault.com/play/1435/An-American-engine-in-Tokyo', | |
81 | 'info_dict': { | |
118f7add | 82 | 'id': '9350_1238021887562UHXB', |
50ad078b | 83 | 'display_id': 'An-American-engine-in-Tokyo', |
118f7add | 84 | 'ext': 'mp4', |
50ad078b YCH |
85 | 'title': 'An American Engine in Tokyo:/nThe collaboration of Epic Games and Square Enix/nFor THE LAST REMINANT', |
86 | }, | |
118f7add RA |
87 | }, |
88 | { | |
89 | # Kaltura Embed | |
90 | 'url': 'https://www.gdcvault.com/play/1026180/Mastering-the-Apex-of-Scaling', | |
91 | 'info_dict': { | |
92 | 'id': '0_h1fg8j3p', | |
93 | 'ext': 'mp4', | |
94 | 'title': 'Mastering the Apex of Scaling Game Servers (Presented by Multiplay)', | |
95 | 'timestamp': 1554401811, | |
96 | 'upload_date': '20190404', | |
97 | 'uploader_id': 'joe@blazestreaming.com', | |
98 | }, | |
50ad078b | 99 | 'params': { |
118f7add | 100 | 'format': 'mp4-408', |
50ad078b YCH |
101 | }, |
102 | }, | |
83cebb8b | 103 | ] |
9e68f9fd | 104 | |
c8ff6457 | 105 | def _login(self, webpage_url, display_id): |
68217024 | 106 | username, password = self._get_login_info() |
50a138d9 | 107 | if username is None or password is None: |
45344855 | 108 | self.report_warning('It looks like ' + webpage_url + ' requires a login. Try specifying a username and password and try again.') |
50a138d9 DW |
109 | return None |
110 | ||
111 | mobj = re.match(r'(?P<root_url>https?://.*?/).*', webpage_url) | |
112 | login_url = mobj.group('root_url') + 'api/login.php' | |
113 | logout_url = mobj.group('root_url') + 'logout' | |
114 | ||
115 | login_form = { | |
116 | 'email': username, | |
117 | 'password': password, | |
118 | } | |
119 | ||
6e6bc8da | 120 | request = sanitized_Request(login_url, urlencode_postdata(login_form)) |
50a138d9 | 121 | request.add_header('Content-Type', 'application/x-www-form-urlencoded') |
c8ff6457 | 122 | self._download_webpage(request, display_id, 'Logging in') |
d23f9ec7 | 123 | webpage = self._download_webpage(webpage_url, display_id, 'Getting authenticated video page') |
c8ff6457 | 124 | self._download_webpage(logout_url, display_id, 'Logging out') |
50a138d9 | 125 | |
d23f9ec7 | 126 | return webpage |
50a138d9 | 127 | |
9e68f9fd | 128 | def _real_extract(self, url): |
118f7add RA |
129 | video_id, name = re.match(self._VALID_URL, url).groups() |
130 | display_id = name or video_id | |
c8ff6457 | 131 | |
d23f9ec7 U |
132 | webpage = self._download_webpage(url, display_id) |
133 | ||
134 | title = self._html_search_regex( | |
135 | r'<td><strong>Session Name:?</strong></td>\s*<td>(.*?)</td>', | |
136 | webpage, 'title') | |
137 | ||
138 | PLAYER_REGEX = r'<iframe src=\"(?P<manifest_url>.*?)\".*?</iframe>' | |
139 | manifest_url = self._html_search_regex( | |
4b819d14 | 140 | PLAYER_REGEX, webpage, 'manifest_url') |
50a138d9 | 141 | |
d23f9ec7 U |
142 | partner_id = self._search_regex( |
143 | r'/p(?:artner_id)?/(\d+)', manifest_url, 'partner id', | |
144 | default='1670711') | |
145 | ||
146 | kaltura_id = self._search_regex( | |
147 | r'entry_id=(?P<id>(?:[^&])+)', manifest_url, | |
148 | 'kaltura id', group='id') | |
83cebb8b | 149 | |
45344855 | 150 | return { |
ec59d657 | 151 | '_type': 'url_transparent', |
d23f9ec7 U |
152 | 'url': 'kaltura:%s:%s' % (partner_id, kaltura_id), |
153 | 'ie_key': KalturaIE.ie_key(), | |
9e68f9fd | 154 | 'id': video_id, |
c8ff6457 | 155 | 'display_id': display_id, |
d23f9ec7 | 156 | 'title': title, |
4b819d14 | 157 | } |