bellmedia.py 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. from .common import InfoExtractor
  2. class BellMediaIE(InfoExtractor):
  3. _VALID_URL = r'''(?x)https?://(?:www\.)?
  4. (?P<domain>
  5. (?:
  6. ctv|
  7. tsn|
  8. bnn(?:bloomberg)?|
  9. thecomedynetwork|
  10. discovery|
  11. discoveryvelocity|
  12. sciencechannel|
  13. investigationdiscovery|
  14. animalplanet|
  15. bravo|
  16. mtv|
  17. space|
  18. etalk|
  19. marilyn
  20. )\.ca|
  21. (?:much|cp24)\.com
  22. )/.*?(?:\b(?:vid(?:eoid)?|clipId)=|-vid|~|%7E|/(?:episode)?)(?P<id>[0-9]{6,})'''
  23. _TESTS = [{
  24. 'url': 'https://www.bnnbloomberg.ca/video/david-cockfield-s-top-picks~1403070',
  25. 'md5': '3e5b8e38370741d5089da79161646635',
  26. 'info_dict': {
  27. 'id': '1403070',
  28. 'ext': 'flv',
  29. 'title': 'David Cockfield\'s Top Picks',
  30. 'description': 'md5:810f7f8c6a83ad5b48677c3f8e5bb2c3',
  31. 'upload_date': '20180525',
  32. 'timestamp': 1527288600,
  33. 'season_id': '73997',
  34. 'season': '2018',
  35. 'thumbnail': 'http://images2.9c9media.com/image_asset/2018_5_25_baf30cbd-b28d-4a18-9903-4bb8713b00f5_PNG_956x536.jpg',
  36. 'tags': [],
  37. 'categories': ['ETFs'],
  38. 'season_number': 8,
  39. 'duration': 272.038,
  40. 'series': 'Market Call Tonight',
  41. },
  42. }, {
  43. 'url': 'http://www.thecomedynetwork.ca/video/player?vid=923582',
  44. 'only_matching': True,
  45. }, {
  46. 'url': 'http://www.tsn.ca/video/expectations-high-for-milos-raonic-at-us-open~939549',
  47. 'only_matching': True,
  48. }, {
  49. 'url': 'http://www.bnn.ca/video/berman-s-call-part-two-viewer-questions~939654',
  50. 'only_matching': True,
  51. }, {
  52. 'url': 'http://www.ctv.ca/YourMorning/Video/S1E6-Monday-August-29-2016-vid938009',
  53. 'only_matching': True,
  54. }, {
  55. 'url': 'http://www.much.com/shows/atmidnight/episode948007/tuesday-september-13-2016',
  56. 'only_matching': True,
  57. }, {
  58. 'url': 'http://www.much.com/shows/the-almost-impossible-gameshow/928979/episode-6',
  59. 'only_matching': True,
  60. }, {
  61. 'url': 'http://www.ctv.ca/DCs-Legends-of-Tomorrow/Video/S2E11-Turncoat-vid1051430',
  62. 'only_matching': True,
  63. }, {
  64. 'url': 'http://www.etalk.ca/video?videoid=663455',
  65. 'only_matching': True,
  66. }, {
  67. 'url': 'https://www.cp24.com/video?clipId=1982548',
  68. 'only_matching': True,
  69. }]
  70. _DOMAINS = {
  71. 'thecomedynetwork': 'comedy',
  72. 'discoveryvelocity': 'discvel',
  73. 'sciencechannel': 'discsci',
  74. 'investigationdiscovery': 'invdisc',
  75. 'animalplanet': 'aniplan',
  76. 'etalk': 'ctv',
  77. 'bnnbloomberg': 'bnn',
  78. 'marilyn': 'ctv_marilyn',
  79. }
  80. def _real_extract(self, url):
  81. domain, video_id = self._match_valid_url(url).groups()
  82. domain = domain.split('.')[0]
  83. return {
  84. '_type': 'url_transparent',
  85. 'id': video_id,
  86. 'url': f'9c9media:{self._DOMAINS.get(domain, domain)}_web:{video_id}',
  87. 'ie_key': 'NineCNineMedia',
  88. }