]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nick.py 
   2  from  __future__ 
import  unicode_literals
   6  from  . mtv 
import  MTVServicesInfoExtractor
   7  from  .. utils 
import  update_url_query
  10  class  NickIE ( MTVServicesInfoExtractor
):   11      # None of videos on the website are still alive?   13      _VALID_URL 
=  r
'https?://(?P<domain>(?:(?:www|beta)\.)?nick(?:jr)?\.com)/(?:[^/]+/)?(?:videos/clip|[^/]+/videos)/(?P<id>[^/?#.]+)'   14      _FEED_URL 
=  'http://udat.mtvnservices.com/service1/dispatch.htm'   15      _GEO_COUNTRIES 
= [ 'US' ]   17          'url' :  'http://www.nick.com/videos/clip/alvinnn-and-the-chipmunks-112-full-episode.html' ,   20                  'md5' :  '6e5adc1e28253bbb1b28ab05403dd4d4' ,   22                      'id' :  'be6a17b0-412d-11e5-8ff7-0026b9414f30' ,   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. \n During a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.' ,   30                  'md5' :  'd7be441fc53a1d4882fa9508a1e5b3ce' ,   32                      'id' :  'be6b8f96-412d-11e5-8ff7-0026b9414f30' ,   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. \n During a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.' ,   40                  'md5' :  'efffe1728a234b2b0d2f2b343dd1946f' ,   42                      'id' :  'be6cf7e6-412d-11e5-8ff7-0026b9414f30' ,   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. \n During a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.' ,   49                  'md5' :  '1ec6690733ab9f41709e274a1d5c7556' ,   51                      'id' :  'be6e3354-412d-11e5-8ff7-0026b9414f30' ,   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. \n During a costume visit to the zoo, Alvin finds himself mistaken for the real Tasmanian devil.' ,   59          'url' :  'http://www.nickjr.com/paw-patrol/videos/pups-save-a-goldrush-s3-ep302-full-episode/' ,   60          'only_matching' :  True ,   62          'url' :  'http://beta.nick.com/nicky-ricky-dicky-and-dawn/videos/nicky-ricky-dicky-dawn-301-full-episode/' ,   63          'only_matching' :  True ,   66      def  _get_feed_query ( self
,  uri
):   68              'feed' :  'nick_arc_player_prime' ,   72      def  _real_extract ( self
,  url
):   73          domain
,  display_id 
=  re
. match ( self
._ VALID
_U RL
,  url
). groups ()   74          video_data 
=  self
._ download
_ json
(   75              'http:// %s /data/video.endLevel.json'  %  domain
,   79          return  self
._ get
_ videos
_ info
( video_data
[ 'player' ] +  video_data
[ 'id' ])   82  class  NickBrIE ( MTVServicesInfoExtractor
):   83      IE_NAME 
=  'nickelodeon:br'   87                              (?P<domain>(?:www\.)?nickjr|mundonick\.uol)\.com\.br|   88                              (?:www\.)?nickjr\.[a-z] {2} |   89                              (?:www\.)?nickelodeonjunior\.fr   91                          /(?:programas/)?[^/]+/videos/(?:episodios/)?(?P<id>[^/?\#.]+)   94          'url' :  'http://www.nickjr.com.br/patrulha-canina/videos/210-labirinto-de-pipoca/' ,   95          'only_matching' :  True ,   97          'url' :  'http://mundonick.uol.com.br/programas/the-loud-house/videos/muitas-irmas/7ljo9j' ,   98          'only_matching' :  True ,  100          'url' :  'http://www.nickjr.nl/paw-patrol/videos/311-ge-wol-dig-om-terug-te-zijn/' ,  101          'only_matching' :  True ,  103          'url' :  'http://www.nickjr.de/blaze-und-die-monster-maschinen/videos/f6caaf8f-e4e8-4cc1-b489-9380d6dcd059/' ,  104          'only_matching' :  True ,  106          'url' :  'http://www.nickelodeonjunior.fr/paw-patrol-la-pat-patrouille/videos/episode-401-entier-paw-patrol/' ,  107          'only_matching' :  True ,  110      def  _real_extract ( self
,  url
):  111          domain
,  display_id 
=  re
. match ( self
._ VALID
_U RL
,  url
). groups ()  112          webpage 
=  self
._ download
_ webpage
( url
,  display_id
)  113          uri 
=  self
._ search
_ regex
(  114              r
'data-(?:contenturi|mgid)="([^"]+)' ,  webpage
,  'mgid' )  115          video_id 
=  self
._ id
_ from
_u ri
( uri
)  116          config 
=  self
._ download
_ json
(  117              'http://media.mtvnservices.com/pmt/e1/access/index.html' ,  120                  'configtype' :  'edge' ,  124          info_url 
=  self
._ remove
_ template
_ parameter
( config
[ 'feedWithQueryParams' ])  125          if  info_url 
==  'None' :  126              if  domain
. startswith ( 'www.' ):  129                  'mundonick.uol' :  'mundonick.com.br' ,  130                  'nickjr' :  'br.nickelodeonjunior.tv' ,  134                  'imageEp' :  content_domain
,  135                  'arcEp' :  content_domain
,  137              if  domain 
==  'nickjr.com.br' :  138                  query
[ 'ep' ] =  'c4b16088'  139              info_url 
=  update_url_query (  140                  'http://feeds.mtvnservices.com/od/feed/intl-mrss-player-feed' ,  query
)  141          return  self
._ get
_ videos
_ info
_ from
_u rl
( info_url
,  video_id
)  144  class  NickDeIE ( MTVServicesInfoExtractor
):  146      _VALID_URL 
=  r
'https?://(?:www\.)?(?P<host>nick\.(?:de|com\.pl|ch)|nickelodeon\.(?:nl|be|at|dk|no|se))/[^/]+/(?:[^/]+/)*(?P<id>[^/?#&]+)'  148          'url' :  'http://www.nick.de/playlist/3773-top-videos/videos/episode/17306-zu-wasser-und-zu-land-rauchende-erdnusse' ,  149          'only_matching' :  True ,  151          'url' :  'http://www.nick.de/shows/342-icarly' ,  152          'only_matching' :  True ,  154          'url' :  'http://www.nickelodeon.nl/shows/474-spongebob/videos/17403-een-kijkje-in-de-keuken-met-sandy-van-binnenuit' ,  155          'only_matching' :  True ,  157          'url' :  'http://www.nickelodeon.at/playlist/3773-top-videos/videos/episode/77993-das-letzte-gefecht' ,  158          'only_matching' :  True ,  160          'url' :  'http://www.nick.com.pl/seriale/474-spongebob-kanciastoporty/wideo/17412-teatr-to-jest-to-rodeo-oszolom' ,  161          'only_matching' :  True ,  163          'url' :  'http://www.nickelodeon.no/program/2626-bulderhuset/videoer/90947-femteklasse-veronica-vs-vanzilla' ,  164          'only_matching' :  True ,  166          'url' :  'http://www.nickelodeon.dk/serier/2626-hojs-hus/videoer/761-tissepause' ,  167          'only_matching' :  True ,  169          'url' :  'http://www.nickelodeon.se/serier/2626-lugn-i-stormen/videos/998-' ,  170          'only_matching' :  True ,  172          'url' :  'http://www.nick.ch/shows/2304-adventure-time-abenteuerzeit-mit-finn-und-jake' ,  173          'only_matching' :  True ,  175          'url' :  'http://www.nickelodeon.be/afspeellijst/4530-top-videos/videos/episode/73917-inval-broodschapper-lariekoek-arie' ,  176          'only_matching' :  True ,  179      def  _extract_mrss_url ( self
,  webpage
,  host
):  180          return  update_url_query ( self
._ search
_ regex
(  181              r
'data-mrss=(["\' ])( ?P
< url
> http
.+ ?
) \
1 ', webpage, ' mrss url
', group=' url
'),  184      def _real_extract(self, url):  185          mobj = re.match(self._VALID_URL, url)  186          video_id = mobj.group(' id ')  187          host = mobj.group(' host
')  189          webpage = self._download_webpage(url, video_id)  191          mrss_url = self._extract_mrss_url(webpage, host)  193          return self._get_videos_info_from_url(mrss_url, video_id)  196  class NickNightIE(NickDeIE):  197      IE_NAME = ' nicknight
'  198      _VALID_URL = r' https?
://( ?
: www\
.)( ?P
< host
> nicknight\
.( ?
: de|at|tv
))/( ?
: playlist|shows
)/( ?
:[ ^
/]+/)*( ?P
< id >[ ^
/ ?
#&]+)'  200          'url' :  'http://www.nicknight.at/shows/977-awkward/videos/85987-nimmer-beste-freunde' ,  201          'only_matching' :  True ,  203          'url' :  'http://www.nicknight.at/shows/977-awkward' ,  204          'only_matching' :  True ,  206          'url' :  'http://www.nicknight.at/shows/1900-faking-it' ,  207          'only_matching' :  True ,  210      def  _extract_mrss_url ( self
,  webpage
, * args
):  211          return  self
._ search
_ regex
(  212              r
'mrss\s*:\s*(["\' ])( ?P
< url
> http
.+ ?
) \
1 ', webpage,  213              ' mrss url
', group=' url
')  216  class NickRuIE(MTVServicesInfoExtractor):  217      IE_NAME = ' nickelodeonru
'  218      _VALID_URL = r' https?
://( ?
: www\
.) nickelodeon\
.( ?
: ru|fr|es|pt|ro|hu|com\
. tr
)/[ ^
/]+/( ?
:[ ^
/]+/)*( ?P
< id >[ ^
/ ?
#&]+)'  220          'url' :  'http://www.nickelodeon.ru/shows/henrydanger/videos/episodes/3-sezon-15-seriya-licenziya-na-polyot/pmomfb#playlist/7airc6' ,  221          'only_matching' :  True ,  223          'url' :  'http://www.nickelodeon.ru/videos/smotri-na-nickelodeon-v-iyule/g9hvh7' ,  224          'only_matching' :  True ,  226          'url' :  'http://www.nickelodeon.fr/programmes/bob-l-eponge/videos/le-marathon-de-booh-kini-bottom-mardi-31-octobre/nfn7z0' ,  227          'only_matching' :  True ,  229          'url' :  'http://www.nickelodeon.es/videos/nickelodeon-consejos-tortitas/f7w7xy' ,  230          'only_matching' :  True ,  232          'url' :  'http://www.nickelodeon.pt/series/spongebob-squarepants/videos/a-bolha-de-tinta-gigante/xutq1b' ,  233          'only_matching' :  True ,  235          'url' :  'http://www.nickelodeon.ro/emisiuni/shimmer-si-shine/video/nahal-din-bomboane/uw5u2k' ,  236          'only_matching' :  True ,  238          'url' :  'http://www.nickelodeon.hu/musorok/spongyabob-kockanadrag/videok/episodes/buborekfujas-az-elszakadt-nadrag/q57iob#playlist/k6te4y' ,  239          'only_matching' :  True ,  241          'url' :  'http://www.nickelodeon.com.tr/programlar/sunger-bob/videolar/kayip-yatak/mgqbjy' ,  242          'only_matching' :  True ,  245      def  _real_extract ( self
,  url
):  246          video_id 
=  self
._ match
_ id
( url
)  247          webpage 
=  self
._ download
_ webpage
( url
,  video_id
)  248          mgid 
=  self
._ extract
_ mgid
( webpage
)  249          return  self
. url_result ( 'http://media.mtvnservices.com/embed/ %s '  %  mgid
)