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.

78 lines
2.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class BellMediaIE(InfoExtractor):
  6. _VALID_URL = r'''(?x)https?://(?:www\.)?
  7. (?P<domain>
  8. (?:
  9. ctv|
  10. tsn|
  11. bnn|
  12. thecomedynetwork|
  13. discovery|
  14. discoveryvelocity|
  15. sciencechannel|
  16. investigationdiscovery|
  17. animalplanet|
  18. bravo|
  19. mtv|
  20. space
  21. )\.ca|
  22. much\.com
  23. )/.*?(?:\bvid=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})'''
  24. _TESTS = [{
  25. 'url': 'http://www.ctv.ca/video/player?vid=706966',
  26. 'md5': 'ff2ebbeae0aa2dcc32a830c3fd69b7b0',
  27. 'info_dict': {
  28. 'id': '706966',
  29. 'ext': 'mp4',
  30. 'title': 'Larry Day and Richard Jutras on the TIFF red carpet of \'Stonewall\'',
  31. 'description': 'etalk catches up with Larry Day and Richard Jutras on the TIFF red carpet of "Stonewall”.',
  32. 'upload_date': '20150919',
  33. 'timestamp': 1442624700,
  34. },
  35. 'expected_warnings': ['HTTP Error 404'],
  36. }, {
  37. 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',
  38. 'only_matching': True,
  39. }, {
  40. 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549',
  41. 'only_matching': True,
  42. }, {
  43. 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654',
  44. 'only_matching': True,
  45. }, {
  46. 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009',
  47. 'only_matching': True,
  48. }, {
  49. 'url': 'http://www.much.com/shows/atmidnight/episode948007/tuesday-september-13-2016',
  50. 'only_matching': True,
  51. }, {
  52. 'url': 'http://www.much.com/shows/the-almost-impossible-gameshow/928979/episode-6',
  53. 'only_matching': True,
  54. }, {
  55. 'url': 'http://www.ctv.ca/DCs-Legends-of-Tomorrow/Video/S2E11-Turncoat-vid1051430',
  56. 'only_matching': True,
  57. }]
  58. _DOMAINS = {
  59. 'thecomedynetwork': 'comedy',
  60. 'discoveryvelocity': 'discvel',
  61. 'sciencechannel': 'discsci',
  62. 'investigationdiscovery': 'invdisc',
  63. 'animalplanet': 'aniplan',
  64. }
  65. def _real_extract(self, url):
  66. domain, video_id = re.match(self._VALID_URL, url).groups()
  67. domain = domain.split('.')[0]
  68. return {
  69. '_type': 'url_transparent',
  70. 'id': video_id,
  71. 'url': '9c9media:%s_web:%s' % (self._DOMAINS.get(domain, domain), video_id),
  72. 'ie_key': 'NineCNineMedia',
  73. }