]>
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' |
10cd2003 | 13 | _VALID_URL = r'https?://(?:(?:www|beta)\.)?nick(?:jr)?\.com/(?:[^/]+/)?(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)' |
a0e5beb0 | 14 | _FEED_URL = 'http://udat.mtvnservices.com/service1/dispatch.htm' |
15 | _TESTS = [{ | |
16 | 'url': 'http://www.nick.com/videos/clip/alvinnn-and-the-chipmunks-112-full-episode.html', | |
17 | 'playlist': [ | |
18 | { | |
19 | 'md5': '6e5adc1e28253bbb1b28ab05403dd4d4', | |
20 | 'info_dict': { | |
21 | 'id': 'be6a17b0-412d-11e5-8ff7-0026b9414f30', | |
22 | 'ext': 'mp4', | |
23 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S1', | |
24 | '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.', | |
25 | ||
26 | } | |
27 | }, | |
28 | { | |
29 | 'md5': 'd7be441fc53a1d4882fa9508a1e5b3ce', | |
30 | 'info_dict': { | |
31 | 'id': 'be6b8f96-412d-11e5-8ff7-0026b9414f30', | |
32 | 'ext': 'mp4', | |
33 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S2', | |
34 | '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.', | |
35 | ||
36 | } | |
37 | }, | |
38 | { | |
39 | 'md5': 'efffe1728a234b2b0d2f2b343dd1946f', | |
40 | 'info_dict': { | |
41 | 'id': 'be6cf7e6-412d-11e5-8ff7-0026b9414f30', | |
42 | 'ext': 'mp4', | |
43 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S3', | |
44 | '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.', | |
45 | } | |
46 | }, | |
47 | { | |
48 | 'md5': '1ec6690733ab9f41709e274a1d5c7556', | |
49 | 'info_dict': { | |
50 | 'id': 'be6e3354-412d-11e5-8ff7-0026b9414f30', | |
51 | 'ext': 'mp4', | |
52 | 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S4', | |
53 | '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.', | |
54 | } | |
55 | }, | |
56 | ], | |
0ab7f4fe YCH |
57 | }, { |
58 | 'url': 'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/', | |
59 | 'only_matching': True, | |
10cd2003 S |
60 | }, { |
61 | 'url': 'http://beta.nick.com/nicky-ricky-dicky-and-dawn/videos/nicky-ricky-dicky-dawn-301-full-episode/', | |
62 | 'only_matching': True, | |
a0e5beb0 | 63 | }] |
64 | ||
65 | def _get_feed_query(self, uri): | |
0c75abbb | 66 | return { |
a0e5beb0 | 67 | 'feed': 'nick_arc_player_prime', |
e565cf60 | 68 | 'mgid': uri, |
0c75abbb | 69 | } |
a0e5beb0 | 70 | |
71 | def _extract_mgid(self, webpage): | |
72 | return self._search_regex(r'data-contenturi="([^"]+)', webpage, 'mgid') | |
f0118760 S |
73 | |
74 | ||
75 | class NickDeIE(MTVServicesInfoExtractor): | |
76 | IE_NAME = 'nick.de' | |
9c82bba0 | 77 | _VALID_URL = r'https?://(?:www\.)?(?P<host>nick\.de|nickelodeon\.(?:nl|at))/(?:playlist|shows)/(?:[^/]+/)*(?P<id>[^/?#&]+)' |
f0118760 S |
78 | _TESTS = [{ |
79 | 'url': 'http://www.nick.de/playlist/3773-top-videos/videos/episode/17306-zu-wasser-und-zu-land-rauchende-erdnusse', | |
80 | 'only_matching': True, | |
81 | }, { | |
82 | 'url': 'http://www.nick.de/shows/342-icarly', | |
83 | 'only_matching': True, | |
f3eeaacb S |
84 | }, { |
85 | 'url': 'http://www.nickelodeon.nl/shows/474-spongebob/videos/17403-een-kijkje-in-de-keuken-met-sandy-van-binnenuit', | |
86 | 'only_matching': True, | |
9c82bba0 S |
87 | }, { |
88 | 'url': 'http://www.nickelodeon.at/playlist/3773-top-videos/videos/episode/77993-das-letzte-gefecht', | |
89 | 'only_matching': True, | |
f0118760 S |
90 | }] |
91 | ||
f449c061 S |
92 | def _extract_mrss_url(self, webpage, host): |
93 | return update_url_query(self._search_regex( | |
94 | r'data-mrss=(["\'])(?P<url>http.+?)\1', webpage, 'mrss url', group='url'), | |
95 | {'siteKey': host}) | |
96 | ||
f0118760 | 97 | def _real_extract(self, url): |
9c82bba0 S |
98 | mobj = re.match(self._VALID_URL, url) |
99 | video_id = mobj.group('id') | |
100 | host = mobj.group('host') | |
f0118760 S |
101 | |
102 | webpage = self._download_webpage(url, video_id) | |
103 | ||
f449c061 | 104 | mrss_url = self._extract_mrss_url(webpage, host) |
f0118760 S |
105 | |
106 | return self._get_videos_info_from_url(mrss_url, video_id) | |
e3577722 N |
107 | |
108 | ||
f449c061 S |
109 | class NickNightIE(NickDeIE): |
110 | IE_NAME = 'nicknight' | |
111 | _VALID_URL = r'https?://(?:www\.)(?P<host>nicknight\.(?:de|at|tv))/(?:playlist|shows)/(?:[^/]+/)*(?P<id>[^/?#&]+)' | |
e3577722 N |
112 | _TESTS = [{ |
113 | 'url': 'http://www.nicknight.at/shows/977-awkward/videos/85987-nimmer-beste-freunde', | |
114 | 'only_matching': True, | |
115 | }, { | |
116 | 'url': 'http://www.nicknight.at/shows/977-awkward', | |
117 | 'only_matching': True, | |
118 | }, { | |
119 | 'url': 'http://www.nicknight.at/shows/1900-faking-it', | |
120 | 'only_matching': True, | |
121 | }] | |
122 | ||
f449c061 S |
123 | def _extract_mrss_url(self, webpage, *args): |
124 | return self._search_regex( | |
125 | r'mrss\s*:\s*(["\'])(?P<url>http.+?)\1', webpage, | |
126 | 'mrss url', group='url') |