]>
Commit | Line | Data |
---|---|---|
a0e5beb0 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
9c82bba0 S |
4 | import re |
5 | ||
a0e5beb0 | 6 | from .mtv import MTVServicesInfoExtractor |
f0118760 | 7 | from ..utils import update_url_query |
a0e5beb0 | 8 | |
9 | ||
10 | class NickIE(MTVServicesInfoExtractor): | |
a3aa814b | 11 | # None of videos on the website are still alive? |
a0e5beb0 | 12 | IE_NAME = 'nick.com' |
5868079e | 13 | _VALID_URL = r'https?://(?P<domain>(?:(?:www|beta)\.)?nick(?:jr)?\.com)/(?:[^/]+/)?(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)' |
a0e5beb0 | 14 | _FEED_URL = 'http://udat.mtvnservices.com/service1/dispatch.htm' |
f0e31e32 | 15 | _GEO_COUNTRIES = ['US'] |
a0e5beb0 | 16 | _TESTS = [{ |
17 | 'url': 'http://www.nick.com/videos/clip/alvinnn-and-the-chipmunks-112-full-episode.html', | |
18 | 'playlist': [ | |
19 | { | |
20 | 'md5': '6e5adc1e28253bbb1b28ab05403dd4d4', | |
21 | 'info_dict': { | |
22 | 'id': 'be6a17b0-412d-11e5-8ff7-0026b9414f30', | |
23 | 'ext': 'mp4', | |
24 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S1', | |
25 | 'description': 'Alvin is convinced his mojo was in a cap he gave to a fan, and must find a way to get his hat back before the Chipmunks’ big concert.\nDuring a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.', | |
26 | ||
27 | } | |
28 | }, | |
29 | { | |
30 | 'md5': 'd7be441fc53a1d4882fa9508a1e5b3ce', | |
31 | 'info_dict': { | |
32 | 'id': 'be6b8f96-412d-11e5-8ff7-0026b9414f30', | |
33 | 'ext': 'mp4', | |
34 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S2', | |
35 | 'description': 'Alvin is convinced his mojo was in a cap he gave to a fan, and must find a way to get his hat back before the Chipmunks’ big concert.\nDuring a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.', | |
36 | ||
37 | } | |
38 | }, | |
39 | { | |
40 | 'md5': 'efffe1728a234b2b0d2f2b343dd1946f', | |
41 | 'info_dict': { | |
42 | 'id': 'be6cf7e6-412d-11e5-8ff7-0026b9414f30', | |
43 | 'ext': 'mp4', | |
44 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S3', | |
45 | 'description': 'Alvin is convinced his mojo was in a cap he gave to a fan, and must find a way to get his hat back before the Chipmunks’ big concert.\nDuring a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.', | |
46 | } | |
47 | }, | |
48 | { | |
49 | 'md5': '1ec6690733ab9f41709e274a1d5c7556', | |
50 | 'info_dict': { | |
51 | 'id': 'be6e3354-412d-11e5-8ff7-0026b9414f30', | |
52 | 'ext': 'mp4', | |
53 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S4', | |
54 | 'description': 'Alvin is convinced his mojo was in a cap he gave to a fan, and must find a way to get his hat back before the Chipmunks’ big concert.\nDuring a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.', | |
55 | } | |
56 | }, | |
57 | ], | |
0ab7f4fe YCH |
58 | }, { |
59 | 'url': 'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/', | |
60 | 'only_matching': True, | |
10cd2003 S |
61 | }, { |
62 | 'url': 'http://beta.nick.com/nicky-ricky-dicky-and-dawn/videos/nicky-ricky-dicky-dawn-301-full-episode/', | |
63 | 'only_matching': True, | |
a0e5beb0 | 64 | }] |
65 | ||
66 | def _get_feed_query(self, uri): | |
0c75abbb | 67 | return { |
a0e5beb0 | 68 | 'feed': 'nick_arc_player_prime', |
e565cf60 | 69 | 'mgid': uri, |
0c75abbb | 70 | } |
a0e5beb0 | 71 | |
5868079e RA |
72 | def _real_extract(self, url): |
73 | domain, display_id = re.match(self._VALID_URL, url).groups() | |
74 | video_data = self._download_json( | |
75 | 'http://%s/data/video.endLevel.json' % domain, | |
76 | display_id, query={ | |
77 | 'urlKey': display_id, | |
78 | }) | |
79 | return self._get_videos_info(video_data['player'] + video_data['id']) | |
f0118760 S |
80 | |
81 | ||
127e98d3 | 82 | class NickBrIE(MTVServicesInfoExtractor): |
08d77a95 | 83 | IE_NAME = 'nickelodeon:br' |
d65a48a0 S |
84 | _VALID_URL = r'''(?x) |
85 | https?:// | |
86 | (?: | |
87 | (?P<domain>(?:www\.)?nickjr|mundonick\.uol)\.com\.br| | |
1344d3e1 | 88 | (?:www\.)?nickjr\.[a-z]{2} |
d65a48a0 S |
89 | ) |
90 | /(?:programas/)?[^/]+/videos/(?:episodios/)?(?P<id>[^/?\#.]+) | |
91 | ''' | |
08d77a95 RA |
92 | _TESTS = [{ |
93 | 'url': 'http://www.nickjr.com.br/patrulha-canina/videos/210-labirinto-de-pipoca/', | |
94 | 'only_matching': True, | |
95 | }, { | |
96 | 'url': 'http://mundonick.uol.com.br/programas/the-loud-house/videos/muitas-irmas/7ljo9j', | |
97 | 'only_matching': True, | |
d65a48a0 S |
98 | }, { |
99 | 'url': 'http://www.nickjr.nl/paw-patrol/videos/311-ge-wol-dig-om-terug-te-zijn/', | |
100 | 'only_matching': True, | |
1344d3e1 S |
101 | }, { |
102 | 'url': 'http://www.nickjr.de/blaze-und-die-monster-maschinen/videos/f6caaf8f-e4e8-4cc1-b489-9380d6dcd059/', | |
103 | 'only_matching': True, | |
08d77a95 RA |
104 | }] |
105 | ||
106 | def _real_extract(self, url): | |
107 | domain, display_id = re.match(self._VALID_URL, url).groups() | |
108 | webpage = self._download_webpage(url, display_id) | |
109 | uri = self._search_regex( | |
110 | r'data-(?:contenturi|mgid)="([^"]+)', webpage, 'mgid') | |
111 | video_id = self._id_from_uri(uri) | |
112 | config = self._download_json( | |
113 | 'http://media.mtvnservices.com/pmt/e1/access/index.html', | |
114 | video_id, query={ | |
115 | 'uri': uri, | |
116 | 'configtype': 'edge', | |
117 | }, headers={ | |
118 | 'Referer': url, | |
119 | }) | |
120 | info_url = self._remove_template_parameter(config['feedWithQueryParams']) | |
121 | if info_url == 'None': | |
122 | if domain.startswith('www.'): | |
123 | domain = domain[4:] | |
124 | content_domain = { | |
125 | 'mundonick.uol': 'mundonick.com.br', | |
126 | 'nickjr': 'br.nickelodeonjunior.tv', | |
127 | }[domain] | |
128 | query = { | |
129 | 'mgid': uri, | |
130 | 'imageEp': content_domain, | |
131 | 'arcEp': content_domain, | |
132 | } | |
133 | if domain == 'nickjr.com.br': | |
134 | query['ep'] = 'c4b16088' | |
135 | info_url = update_url_query( | |
136 | 'http://feeds.mtvnservices.com/od/feed/intl-mrss-player-feed', query) | |
137 | return self._get_videos_info_from_url(info_url, video_id) | |
138 | ||
139 | ||
f0118760 S |
140 | class NickDeIE(MTVServicesInfoExtractor): |
141 | IE_NAME = 'nick.de' | |
f03ee0b3 | 142 | _VALID_URL = r'https?://(?:www\.)?(?P<host>nick\.(?:de|com\.pl|ch)|nickelodeon\.(?:nl|be|at|dk|no|se))/[^/]+/(?:[^/]+/)*(?P<id>[^/?#&]+)' |
f0118760 S |
143 | _TESTS = [{ |
144 | 'url': 'http://www.nick.de/playlist/3773-top-videos/videos/episode/17306-zu-wasser-und-zu-land-rauchende-erdnusse', | |
145 | 'only_matching': True, | |
146 | }, { | |
147 | 'url': 'http://www.nick.de/shows/342-icarly', | |
148 | 'only_matching': True, | |
f3eeaacb S |
149 | }, { |
150 | 'url': 'http://www.nickelodeon.nl/shows/474-spongebob/videos/17403-een-kijkje-in-de-keuken-met-sandy-van-binnenuit', | |
151 | 'only_matching': True, | |
9c82bba0 S |
152 | }, { |
153 | 'url': 'http://www.nickelodeon.at/playlist/3773-top-videos/videos/episode/77993-das-letzte-gefecht', | |
154 | 'only_matching': True, | |
dee04d24 S |
155 | }, { |
156 | 'url': 'http://www.nick.com.pl/seriale/474-spongebob-kanciastoporty/wideo/17412-teatr-to-jest-to-rodeo-oszolom', | |
157 | 'only_matching': True, | |
3ebbd999 AS |
158 | }, { |
159 | 'url': 'http://www.nickelodeon.no/program/2626-bulderhuset/videoer/90947-femteklasse-veronica-vs-vanzilla', | |
160 | 'only_matching': True, | |
161 | }, { | |
162 | 'url': 'http://www.nickelodeon.dk/serier/2626-hojs-hus/videoer/761-tissepause', | |
163 | 'only_matching': True, | |
164 | }, { | |
165 | 'url': 'http://www.nickelodeon.se/serier/2626-lugn-i-stormen/videos/998-', | |
166 | 'only_matching': True, | |
cf6bda31 S |
167 | }, { |
168 | 'url': 'http://www.nick.ch/shows/2304-adventure-time-abenteuerzeit-mit-finn-und-jake', | |
169 | 'only_matching': True, | |
f03ee0b3 S |
170 | }, { |
171 | 'url': 'http://www.nickelodeon.be/afspeellijst/4530-top-videos/videos/episode/73917-inval-broodschapper-lariekoek-arie', | |
172 | 'only_matching': True, | |
f0118760 S |
173 | }] |
174 | ||
f449c061 S |
175 | def _extract_mrss_url(self, webpage, host): |
176 | return update_url_query(self._search_regex( | |
177 | r'data-mrss=(["\'])(?P<url>http.+?)\1', webpage, 'mrss url', group='url'), | |
178 | {'siteKey': host}) | |
179 | ||
f0118760 | 180 | def _real_extract(self, url): |
9c82bba0 S |
181 | mobj = re.match(self._VALID_URL, url) |
182 | video_id = mobj.group('id') | |
183 | host = mobj.group('host') | |
f0118760 S |
184 | |
185 | webpage = self._download_webpage(url, video_id) | |
186 | ||
f449c061 | 187 | mrss_url = self._extract_mrss_url(webpage, host) |
f0118760 S |
188 | |
189 | return self._get_videos_info_from_url(mrss_url, video_id) | |
e3577722 N |
190 | |
191 | ||
f449c061 S |
192 | class NickNightIE(NickDeIE): |
193 | IE_NAME = 'nicknight' | |
194 | _VALID_URL = r'https?://(?:www\.)(?P<host>nicknight\.(?:de|at|tv))/(?:playlist|shows)/(?:[^/]+/)*(?P<id>[^/?#&]+)' | |
e3577722 N |
195 | _TESTS = [{ |
196 | 'url': 'http://www.nicknight.at/shows/977-awkward/videos/85987-nimmer-beste-freunde', | |
197 | 'only_matching': True, | |
198 | }, { | |
199 | 'url': 'http://www.nicknight.at/shows/977-awkward', | |
200 | 'only_matching': True, | |
201 | }, { | |
202 | 'url': 'http://www.nicknight.at/shows/1900-faking-it', | |
203 | 'only_matching': True, | |
204 | }] | |
205 | ||
f449c061 S |
206 | def _extract_mrss_url(self, webpage, *args): |
207 | return self._search_regex( | |
208 | r'mrss\s*:\s*(["\'])(?P<url>http.+?)\1', webpage, | |
209 | 'mrss url', group='url') | |
c99d6890 S |
210 | |
211 | ||
212 | class NickRuIE(MTVServicesInfoExtractor): | |
213 | IE_NAME = 'nickelodeonru' | |
266fbd6b | 214 | _VALID_URL = r'https?://(?:www\.)nickelodeon\.(?:ru|fr|es|pt|ro|hu|com\.tr)/[^/]+/(?:[^/]+/)*(?P<id>[^/?#&]+)' |
c99d6890 S |
215 | _TESTS = [{ |
216 | 'url': 'http://www.nickelodeon.ru/shows/henrydanger/videos/episodes/3-sezon-15-seriya-licenziya-na-polyot/pmomfb#playlist/7airc6', | |
217 | 'only_matching': True, | |
218 | }, { | |
219 | 'url': 'http://www.nickelodeon.ru/videos/smotri-na-nickelodeon-v-iyule/g9hvh7', | |
220 | 'only_matching': True, | |
9ff6273c S |
221 | }, { |
222 | 'url': 'http://www.nickelodeon.fr/programmes/bob-l-eponge/videos/le-marathon-de-booh-kini-bottom-mardi-31-octobre/nfn7z0', | |
223 | 'only_matching': True, | |
224 | }, { | |
225 | 'url': 'http://www.nickelodeon.es/videos/nickelodeon-consejos-tortitas/f7w7xy', | |
226 | 'only_matching': True, | |
227 | }, { | |
228 | 'url': 'http://www.nickelodeon.pt/series/spongebob-squarepants/videos/a-bolha-de-tinta-gigante/xutq1b', | |
229 | 'only_matching': True, | |
230 | }, { | |
231 | 'url': 'http://www.nickelodeon.ro/emisiuni/shimmer-si-shine/video/nahal-din-bomboane/uw5u2k', | |
232 | 'only_matching': True, | |
233 | }, { | |
234 | 'url': 'http://www.nickelodeon.hu/musorok/spongyabob-kockanadrag/videok/episodes/buborekfujas-az-elszakadt-nadrag/q57iob#playlist/k6te4y', | |
235 | 'only_matching': True, | |
266fbd6b S |
236 | }, { |
237 | 'url': 'http://www.nickelodeon.com.tr/programlar/sunger-bob/videolar/kayip-yatak/mgqbjy', | |
238 | 'only_matching': True, | |
c99d6890 S |
239 | }] |
240 | ||
241 | def _real_extract(self, url): | |
242 | video_id = self._match_id(url) | |
243 | webpage = self._download_webpage(url, video_id) | |
244 | mgid = self._extract_mgid(webpage) | |
245 | return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid) |