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.

107 lines
4.3 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 .screenwavemedia import ScreenwaveMediaIE
  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. # Youtube embedded video
  33. 'url': 'http://cinemassacre.com/2006/12/07/chronologically-confused-about-bad-movie-and-video-game-sequel-titles/',
  34. 'md5': 'df4cf8a1dcedaec79a73d96d83b99023',
  35. 'info_dict': {
  36. 'id': 'OEVzPCY2T-g',
  37. 'ext': 'mp4',
  38. 'title': 'AVGN: Chronologically Confused about Bad Movie and Video Game Sequel Titles',
  39. 'upload_date': '20061207',
  40. 'uploader': 'Cinemassacre',
  41. 'uploader_id': 'JamesNintendoNerd',
  42. 'description': 'md5:784734696c2b8b7f4b8625cc799e07f6',
  43. }
  44. },
  45. {
  46. # Youtube embedded video
  47. 'url': 'http://cinemassacre.com/2006/09/01/mckids/',
  48. 'md5': '6eb30961fa795fedc750eac4881ad2e1',
  49. 'info_dict': {
  50. 'id': 'FnxsNhuikpo',
  51. 'ext': 'mp4',
  52. 'upload_date': '20060901',
  53. 'uploader': 'Cinemassacre Extras',
  54. 'description': 'md5:de9b751efa9e45fbaafd9c8a1123ed53',
  55. 'uploader_id': 'Cinemassacre',
  56. 'title': 'AVGN: McKids',
  57. }
  58. },
  59. {
  60. 'url': 'http://cinemassacre.com/2015/05/25/mario-kart-64-nintendo-64-james-mike-mondays/',
  61. 'md5': '1376908e49572389e7b06251a53cdd08',
  62. 'info_dict': {
  63. 'id': 'Cinemassacre-555779690c440',
  64. 'ext': 'mp4',
  65. '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!',
  66. 'title': 'Mario Kart 64 (Nintendo 64) James & Mike Mondays',
  67. 'upload_date': '20150525',
  68. }
  69. }
  70. ]
  71. def _real_extract(self, url):
  72. mobj = re.match(self._VALID_URL, url)
  73. display_id = mobj.group('display_id')
  74. video_date = mobj.group('date_y') + mobj.group('date_m') + mobj.group('date_d')
  75. webpage = self._download_webpage(url, display_id)
  76. playerdata_url = self._search_regex(
  77. [
  78. ScreenwaveMediaIE.EMBED_PATTERN,
  79. r'<iframe[^>]+src="(?P<url>(?:https?:)?//(?:[^.]+\.)?youtube\.com/.+?)"',
  80. ],
  81. webpage, 'player data URL', default=None, group='url')
  82. if not playerdata_url:
  83. raise ExtractorError('Unable to find player data')
  84. video_title = self._html_search_regex(
  85. r'<title>(?P<title>.+?)\|', webpage, 'title')
  86. video_description = self._html_search_regex(
  87. r'<div class="entry-content">(?P<description>.+?)</div>',
  88. webpage, 'description', flags=re.DOTALL, fatal=False)
  89. video_thumbnail = self._og_search_thumbnail(webpage)
  90. return {
  91. '_type': 'url_transparent',
  92. 'display_id': display_id,
  93. 'title': video_title,
  94. 'description': video_description,
  95. 'upload_date': video_date,
  96. 'thumbnail': video_thumbnail,
  97. 'url': playerdata_url,
  98. }