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.

85 lines
2.8 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(?:bloomberg)?|
  12. thecomedynetwork|
  13. discovery|
  14. discoveryvelocity|
  15. sciencechannel|
  16. investigationdiscovery|
  17. animalplanet|
  18. bravo|
  19. mtv|
  20. space|
  21. etalk|
  22. marilyn
  23. )\.ca|
  24. much\.com
  25. )/.*?(?:\bvid(?:eoid)?=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})'''
  26. _TESTS = [{
  27. 'url': 'https://www.bnnbloomberg.ca/video/david-cockfield-s-top-picks~1403070',
  28. 'md5': '36d3ef559cfe8af8efe15922cd3ce950',
  29. 'info_dict': {
  30. 'id': '1403070',
  31. 'ext': 'flv',
  32. 'title': 'David Cockfield\'s Top Picks',
  33. 'description': 'md5:810f7f8c6a83ad5b48677c3f8e5bb2c3',
  34. 'upload_date': '20180525',
  35. 'timestamp': 1527288600,
  36. },
  37. }, {
  38. 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',
  39. 'only_matching': True,
  40. }, {
  41. 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549',
  42. 'only_matching': True,
  43. }, {
  44. 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654',
  45. 'only_matching': True,
  46. }, {
  47. 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009',
  48. 'only_matching': True,
  49. }, {
  50. 'url': 'http://www.much.com/shows/atmidnight/episode948007/tuesday-september-13-2016',
  51. 'only_matching': True,
  52. }, {
  53. 'url': 'http://www.much.com/shows/the-almost-impossible-gameshow/928979/episode-6',
  54. 'only_matching': True,
  55. }, {
  56. 'url': 'http://www.ctv.ca/DCs-Legends-of-Tomorrow/Video/S2E11-Turncoat-vid1051430',
  57. 'only_matching': True,
  58. }, {
  59. 'url': 'http://www.etalk.ca/video?videoid=663455',
  60. 'only_matching': True,
  61. }]
  62. _DOMAINS = {
  63. 'thecomedynetwork': 'comedy',
  64. 'discoveryvelocity': 'discvel',
  65. 'sciencechannel': 'discsci',
  66. 'investigationdiscovery': 'invdisc',
  67. 'animalplanet': 'aniplan',
  68. 'etalk': 'ctv',
  69. 'bnnbloomberg': 'bnn',
  70. 'marilyn': 'ctv_marilyn',
  71. }
  72. def _real_extract(self, url):
  73. domain, video_id = re.match(self._VALID_URL, url).groups()
  74. domain = domain.split('.')[0]
  75. return {
  76. '_type': 'url_transparent',
  77. 'id': video_id,
  78. 'url': '9c9media:%s_web:%s' % (self._DOMAINS.get(domain, domain), video_id),
  79. 'ie_key': 'NineCNineMedia',
  80. }