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.

81 lines
3.1 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. 'url': 'http://cinemassacre.com/2006/12/07/chronologically-confused-about-bad-movie-and-video-game-sequel-titles/',
  33. 'md5': 'ca9b3c8dd5a66f9375daeb5135f5a3de',
  34. 'info_dict': {
  35. 'id': '4065369',
  36. 'ext': 'flv',
  37. 'title': 'AVGN: Chronologically Confused about Bad Movie and Video Game Sequel Titles',
  38. 'upload_date': '20061207',
  39. 'uploader': 'cinemassacre',
  40. 'uploader_id': '250778',
  41. 'timestamp': 1283233867,
  42. 'description': 'md5:0a108c78d130676b207d0f6d029ecffd',
  43. }
  44. }
  45. ]
  46. def _real_extract(self, url):
  47. mobj = re.match(self._VALID_URL, url)
  48. display_id = mobj.group('display_id')
  49. video_date = mobj.group('date_y') + mobj.group('date_m') + mobj.group('date_d')
  50. webpage = self._download_webpage(url, display_id)
  51. playerdata_url = self._search_regex(
  52. r'src="(http://player\.screenwavemedia\.com/play/[a-zA-Z]+\.php\?[^"]*\bid=.+?)"',
  53. webpage, 'player data URL', default=None)
  54. if not playerdata_url:
  55. playerdata_url = BlipTVIE._extract_url(webpage)
  56. if not playerdata_url:
  57. raise ExtractorError('Unable to find player data')
  58. video_title = self._html_search_regex(
  59. r'<title>(?P<title>.+?)\|', webpage, 'title')
  60. video_description = self._html_search_regex(
  61. r'<div class="entry-content">(?P<description>.+?)</div>',
  62. webpage, 'description', flags=re.DOTALL, fatal=False)
  63. video_thumbnail = self._og_search_thumbnail(webpage)
  64. return {
  65. '_type': 'url_transparent',
  66. 'display_id': display_id,
  67. 'title': video_title,
  68. 'description': video_description,
  69. 'upload_date': video_date,
  70. 'thumbnail': video_thumbnail,
  71. 'url': playerdata_url,
  72. }