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.

111 lines
4.4 KiB

  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. from ..utils import ExtractorError
  6. from .bliptv import BlipTVIE
  7. from .screenwavemedia import ScreenwaveMediaIE
  8. class CinemassacreIE(InfoExtractor):
  9. _VALID_URL = 'https?://(?:www\.)?cinemassacre\.com/(?P<date_y>[0-9]{4})/(?P<date_m>[0-9]{2})/(?P<date_d>[0-9]{2})/(?P<display_id>[^?#/]+)'
  10. _TESTS = [
  11. {
  12. 'url': 'http://cinemassacre.com/2012/11/10/avgn-the-movie-trailer/',
  13. 'md5': 'fde81fbafaee331785f58cd6c0d46190',
  14. 'info_dict': {
  15. 'id': 'Cinemassacre-19911',
  16. 'ext': 'mp4',
  17. 'upload_date': '20121110',
  18. 'title': '“Angry Video Game Nerd: The Movie” – Trailer',
  19. 'description': 'md5:fb87405fcb42a331742a0dce2708560b',
  20. },
  21. },
  22. {
  23. 'url': 'http://cinemassacre.com/2013/10/02/the-mummys-hand-1940',
  24. 'md5': 'd72f10cd39eac4215048f62ab477a511',
  25. 'info_dict': {
  26. 'id': 'Cinemassacre-521be8ef82b16',
  27. 'ext': 'mp4',
  28. 'upload_date': '20131002',
  29. 'title': 'The Mummy’s Hand (1940)',
  30. },
  31. },
  32. {
  33. # blip.tv embedded video
  34. 'url': 'http://cinemassacre.com/2006/12/07/chronologically-confused-about-bad-movie-and-video-game-sequel-titles/',
  35. 'md5': 'ca9b3c8dd5a66f9375daeb5135f5a3de',
  36. 'info_dict': {
  37. 'id': '4065369',
  38. 'ext': 'flv',
  39. 'title': 'AVGN: Chronologically Confused about Bad Movie and Video Game Sequel Titles',
  40. 'upload_date': '20061207',
  41. 'uploader': 'cinemassacre',
  42. 'uploader_id': '250778',
  43. 'timestamp': 1283233867,
  44. 'description': 'md5:0a108c78d130676b207d0f6d029ecffd',
  45. }
  46. },
  47. {
  48. # Youtube embedded video
  49. 'url': 'http://cinemassacre.com/2006/09/01/mckids/',
  50. 'md5': '6eb30961fa795fedc750eac4881ad2e1',
  51. 'info_dict': {
  52. 'id': 'FnxsNhuikpo',
  53. 'ext': 'mp4',
  54. 'upload_date': '20060901',
  55. 'uploader': 'Cinemassacre Extras',
  56. 'description': 'md5:de9b751efa9e45fbaafd9c8a1123ed53',
  57. 'uploader_id': 'Cinemassacre',
  58. 'title': 'AVGN: McKids',
  59. }
  60. },
  61. {
  62. 'url': 'http://cinemassacre.com/2015/05/25/mario-kart-64-nintendo-64-james-mike-mondays/',
  63. 'md5': '1376908e49572389e7b06251a53cdd08',
  64. 'info_dict': {
  65. 'id': 'Cinemassacre-555779690c440',
  66. 'ext': 'mp4',
  67. 'description': 'Let’s Play Mario Kart 64 !! Mario Kart 64 is a classic go-kart racing game released for the Nintendo 64 (N64). Today James & Mike do 4 player Battle Mode with Kyle and Bootsy!',
  68. 'title': 'Mario Kart 64 (Nintendo 64) James & Mike Mondays',
  69. 'upload_date': '20150525',
  70. }
  71. }
  72. ]
  73. def _real_extract(self, url):
  74. mobj = re.match(self._VALID_URL, url)
  75. display_id = mobj.group('display_id')
  76. video_date = mobj.group('date_y') + mobj.group('date_m') + mobj.group('date_d')
  77. webpage = self._download_webpage(url, display_id)
  78. playerdata_url = self._search_regex(
  79. [
  80. ScreenwaveMediaIE.EMBED_PATTERN,
  81. r'<iframe[^>]+src="(?P<url>(?:https?:)?//(?:[^.]+\.)?youtube\.com/.+?)"',
  82. ],
  83. webpage, 'player data URL', default=None, group='url')
  84. if not playerdata_url:
  85. playerdata_url = BlipTVIE._extract_url(webpage)
  86. if not playerdata_url:
  87. raise ExtractorError('Unable to find player data')
  88. video_title = self._html_search_regex(
  89. r'<title>(?P<title>.+?)\|', webpage, 'title')
  90. video_description = self._html_search_regex(
  91. r'<div class="entry-content">(?P<description>.+?)</div>',
  92. webpage, 'description', flags=re.DOTALL, fatal=False)
  93. video_thumbnail = self._og_search_thumbnail(webpage)
  94. return {
  95. '_type': 'url_transparent',
  96. 'display_id': display_id,
  97. 'title': video_title,
  98. 'description': video_description,
  99. 'upload_date': video_date,
  100. 'thumbnail': video_thumbnail,
  101. 'url': playerdata_url,
  102. }