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.

99 lines
3.8 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. def _real_extract(self, url):
  62. mobj = re.match(self._VALID_URL, url)
  63. display_id = mobj.group('display_id')
  64. video_date = mobj.group('date_y') + mobj.group('date_m') + mobj.group('date_d')
  65. webpage = self._download_webpage(url, display_id)
  66. playerdata_url = self._search_regex(
  67. [
  68. r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
  69. r'<iframe[^>]+src="((?:https?:)?//(?:[^.]+\.)?youtube\.com/.+?)"',
  70. ],
  71. webpage, 'player data URL', default=None)
  72. if not playerdata_url:
  73. playerdata_url = BlipTVIE._extract_url(webpage)
  74. if not playerdata_url:
  75. raise ExtractorError('Unable to find player data')
  76. video_title = self._html_search_regex(
  77. r'<title>(?P<title>.+?)\|', webpage, 'title')
  78. video_description = self._html_search_regex(
  79. r'<div class="entry-content">(?P<description>.+?)</div>',
  80. webpage, 'description', flags=re.DOTALL, fatal=False)
  81. video_thumbnail = self._og_search_thumbnail(webpage)
  82. return {
  83. '_type': 'url_transparent',
  84. 'display_id': display_id,
  85. 'title': video_title,
  86. 'description': video_description,
  87. 'upload_date': video_date,
  88. 'thumbnail': video_thumbnail,
  89. 'url': playerdata_url,
  90. }