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.

72 lines
2.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .theplatform import ThePlatformFeedIE
  5. from ..utils import int_or_none
  6. class CorusIE(ThePlatformFeedIE):
  7. _VALID_URL = r'https?://(?:www\.)?(?P<domain>(?:globaltv|etcanada)\.com|(?:hgtv|foodnetwork|slice)\.ca)/(?:video/|(?:[^/]+/)+(?:videos/[a-z0-9-]+-|video\.html\?.*?\bv=))(?P<id>\d+)'
  8. _TESTS = [{
  9. 'url': 'http://www.hgtv.ca/shows/bryan-inc/videos/movie-night-popcorn-with-bryan-870923331648/',
  10. 'md5': '05dcbca777bf1e58c2acbb57168ad3a6',
  11. 'info_dict': {
  12. 'id': '870923331648',
  13. 'ext': 'mp4',
  14. 'title': 'Movie Night Popcorn with Bryan',
  15. 'description': 'Bryan whips up homemade popcorn, the old fashion way for Jojo and Lincoln.',
  16. 'uploader': 'SHWM-NEW',
  17. 'upload_date': '20170206',
  18. 'timestamp': 1486392197,
  19. },
  20. }, {
  21. 'url': 'http://www.foodnetwork.ca/shows/chopped/video/episode/chocolate-obsession/video.html?v=872683587753',
  22. 'only_matching': True,
  23. }, {
  24. 'url': 'http://etcanada.com/video/873675331955/meet-the-survivor-game-changers-castaways-part-2/',
  25. 'only_matching': True,
  26. }]
  27. _TP_FEEDS = {
  28. 'globaltv': {
  29. 'feed_id': 'ChQqrem0lNUp',
  30. 'account_id': 2269680845,
  31. },
  32. 'etcanada': {
  33. 'feed_id': 'ChQqrem0lNUp',
  34. 'account_id': 2269680845,
  35. },
  36. 'hgtv': {
  37. 'feed_id': 'L0BMHXi2no43',
  38. 'account_id': 2414428465,
  39. },
  40. 'foodnetwork': {
  41. 'feed_id': 'ukK8o58zbRmJ',
  42. 'account_id': 2414429569,
  43. },
  44. 'slice': {
  45. 'feed_id': '5tUJLgV2YNJ5',
  46. 'account_id': 2414427935,
  47. },
  48. }
  49. def _real_extract(self, url):
  50. domain, video_id = re.match(self._VALID_URL, url).groups()
  51. feed_info = self._TP_FEEDS[domain.split('.')[0]]
  52. return self._extract_feed_info('dtjsEC', feed_info['feed_id'], 'byId=' + video_id, video_id, lambda e: {
  53. 'episode_number': int_or_none(e.get('pl1$episode')),
  54. 'season_number': int_or_none(e.get('pl1$season')),
  55. 'series': e.get('pl1$show'),
  56. }, {
  57. 'HLS': {
  58. 'manifest': 'm3u',
  59. },
  60. 'DesktopHLS Default': {
  61. 'manifest': 'm3u',
  62. },
  63. 'MP4 MBR': {
  64. 'manifest': 'm3u',
  65. },
  66. }, feed_info['account_id'])