You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
3.1 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .mtv import MTVServicesInfoExtractor
  4. from ..compat import compat_urllib_parse
  5. class NickIE(MTVServicesInfoExtractor):
  6. IE_NAME = 'nick.com'
  7. _VALID_URL = r'https?://(?:www\.)?nick\.com/videos/clip/(?P<id>[^/?#.]+)'
  8. _FEED_URL = 'http://udat.mtvnservices.com/service1/dispatch.htm'
  9. _TESTS = [{
  10. 'url': 'http://www.nick.com/videos/clip/alvinnn-and-the-chipmunks-112-full-episode.html',
  11. 'playlist': [
  12. {
  13. 'md5': '6e5adc1e28253bbb1b28ab05403dd4d4',
  14. 'info_dict': {
  15. 'id': 'be6a17b0-412d-11e5-8ff7-0026b9414f30',
  16. 'ext': 'mp4',
  17. 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S1',
  18. '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.',
  19. }
  20. },
  21. {
  22. 'md5': 'd7be441fc53a1d4882fa9508a1e5b3ce',
  23. 'info_dict': {
  24. 'id': 'be6b8f96-412d-11e5-8ff7-0026b9414f30',
  25. 'ext': 'mp4',
  26. 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S2',
  27. '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.',
  28. }
  29. },
  30. {
  31. 'md5': 'efffe1728a234b2b0d2f2b343dd1946f',
  32. 'info_dict': {
  33. 'id': 'be6cf7e6-412d-11e5-8ff7-0026b9414f30',
  34. 'ext': 'mp4',
  35. 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S3',
  36. '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.',
  37. }
  38. },
  39. {
  40. 'md5': '1ec6690733ab9f41709e274a1d5c7556',
  41. 'info_dict': {
  42. 'id': 'be6e3354-412d-11e5-8ff7-0026b9414f30',
  43. 'ext': 'mp4',
  44. 'title': 'ALVINNN!!! and The Chipmunks: "Mojo Missing/Who\'s The Animal" S4',
  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. }]
  50. def _get_feed_query(self, uri):
  51. return compat_urllib_parse.urlencode({
  52. 'feed': 'nick_arc_player_prime',
  53. 'mgid': uri,
  54. })
  55. def _extract_mgid(self, webpage):
  56. return self._search_regex(r'data-contenturi="([^"]+)', webpage, 'mgid')