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.

120 lines
4.9 KiB

9 years ago
9 years ago
9 years ago
  1. from __future__ import unicode_literals
  2. from .nhl import NHLBaseIE
  3. class MLBIE(NHLBaseIE):
  4. _VALID_URL = r'''(?x)
  5. https?://
  6. (?:[\da-z_-]+\.)*(?P<site>mlb)\.com/
  7. (?:
  8. (?:
  9. (?:[^/]+/)*c-|
  10. (?:
  11. shared/video/embed/(?:embed|m-internal-embed)\.html|
  12. (?:[^/]+/)+(?:play|index)\.jsp|
  13. )\?.*?\bcontent_id=
  14. )
  15. (?P<id>\d+)
  16. )
  17. '''
  18. _CONTENT_DOMAIN = 'content.mlb.com'
  19. _TESTS = [
  20. {
  21. 'url': 'https://www.mlb.com/mariners/video/ackleys-spectacular-catch/c-34698933',
  22. 'md5': '632358dacfceec06bad823b83d21df2d',
  23. 'info_dict': {
  24. 'id': '34698933',
  25. 'ext': 'mp4',
  26. 'title': "Ackley's spectacular catch",
  27. 'description': 'md5:7f5a981eb4f3cbc8daf2aeffa2215bf0',
  28. 'duration': 66,
  29. 'timestamp': 1405995000,
  30. 'upload_date': '20140722',
  31. 'thumbnail': r're:^https?://.*\.jpg$',
  32. },
  33. },
  34. {
  35. 'url': 'https://www.mlb.com/video/stanton-prepares-for-derby/c-34496663',
  36. 'md5': 'bf2619bf9cacc0a564fc35e6aeb9219f',
  37. 'info_dict': {
  38. 'id': '34496663',
  39. 'ext': 'mp4',
  40. 'title': 'Stanton prepares for Derby',
  41. 'description': 'md5:d00ce1e5fd9c9069e9c13ab4faedfa57',
  42. 'duration': 46,
  43. 'timestamp': 1405120200,
  44. 'upload_date': '20140711',
  45. 'thumbnail': r're:^https?://.*\.jpg$',
  46. },
  47. },
  48. {
  49. 'url': 'https://www.mlb.com/video/cespedes-repeats-as-derby-champ/c-34578115',
  50. 'md5': '99bb9176531adc600b90880fb8be9328',
  51. 'info_dict': {
  52. 'id': '34578115',
  53. 'ext': 'mp4',
  54. 'title': 'Cespedes repeats as Derby champ',
  55. 'description': 'md5:08df253ce265d4cf6fb09f581fafad07',
  56. 'duration': 488,
  57. 'timestamp': 1405414336,
  58. 'upload_date': '20140715',
  59. 'thumbnail': r're:^https?://.*\.jpg$',
  60. },
  61. },
  62. {
  63. 'url': 'https://www.mlb.com/video/bautista-on-home-run-derby/c-34577915',
  64. 'md5': 'da8b57a12b060e7663ee1eebd6f330ec',
  65. 'info_dict': {
  66. 'id': '34577915',
  67. 'ext': 'mp4',
  68. 'title': 'Bautista on Home Run Derby',
  69. 'description': 'md5:b80b34031143d0986dddc64a8839f0fb',
  70. 'duration': 52,
  71. 'timestamp': 1405405122,
  72. 'upload_date': '20140715',
  73. 'thumbnail': r're:^https?://.*\.jpg$',
  74. },
  75. },
  76. {
  77. 'url': 'https://www.mlb.com/news/blue-jays-kevin-pillar-goes-spidey-up-the-wall-to-rob-tim-beckham-of-a-homer/c-118550098',
  78. 'md5': 'e09e37b552351fddbf4d9e699c924d68',
  79. 'info_dict': {
  80. 'id': '75609783',
  81. 'ext': 'mp4',
  82. 'title': 'Must C: Pillar climbs for catch',
  83. 'description': '4/15/15: Blue Jays outfielder Kevin Pillar continues his defensive dominance by climbing the wall in left to rob Tim Beckham of a home run',
  84. 'timestamp': 1429139220,
  85. 'upload_date': '20150415',
  86. }
  87. },
  88. {
  89. 'url': 'https://www.mlb.com/video/hargrove-homers-off-caldwell/c-1352023483?tid=67793694',
  90. 'only_matching': True,
  91. },
  92. {
  93. 'url': 'http://m.mlb.com/shared/video/embed/embed.html?content_id=35692085&topic_id=6479266&width=400&height=224&property=mlb',
  94. 'only_matching': True,
  95. },
  96. {
  97. 'url': 'http://mlb.mlb.com/shared/video/embed/embed.html?content_id=36599553',
  98. 'only_matching': True,
  99. },
  100. {
  101. 'url': 'http://mlb.mlb.com/es/video/play.jsp?content_id=36599553',
  102. 'only_matching': True,
  103. },
  104. {
  105. 'url': 'https://www.mlb.com/cardinals/video/piscottys-great-sliding-catch/c-51175783',
  106. 'only_matching': True,
  107. },
  108. {
  109. # From http://m.mlb.com/news/article/118550098/blue-jays-kevin-pillar-goes-spidey-up-the-wall-to-rob-tim-beckham-of-a-homer
  110. 'url': 'http://mlb.mlb.com/shared/video/embed/m-internal-embed.html?content_id=75609783&property=mlb&autoplay=true&hashmode=false&siteSection=mlb/multimedia/article_118550098/article_embed&club=mlb',
  111. 'only_matching': True,
  112. },
  113. {
  114. 'url': 'https://www.mlb.com/cut4/carlos-gomez-borrowed-sunglasses-from-an-as-fan/c-278912842',
  115. 'only_matching': True,
  116. }
  117. ]