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.

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