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.

59 lines
2.0 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import parse_duration
  4. class DHMIE(InfoExtractor):
  5. IE_DESC = 'Filmarchiv - Deutsches Historisches Museum'
  6. _VALID_URL = r'https?://(?:www\.)?dhm\.de/filmarchiv/(?:[^/]+/)+(?P<id>[^/]+)'
  7. _TESTS = [{
  8. 'url': 'http://www.dhm.de/filmarchiv/die-filme/the-marshallplan-at-work-in-west-germany/',
  9. 'md5': '11c475f670209bf6acca0b2b7ef51827',
  10. 'info_dict': {
  11. 'id': 'the-marshallplan-at-work-in-west-germany',
  12. 'ext': 'flv',
  13. 'title': 'MARSHALL PLAN AT WORK IN WESTERN GERMANY, THE',
  14. 'description': 'md5:1fabd480c153f97b07add61c44407c82',
  15. 'duration': 660,
  16. 'thumbnail': 're:^https?://.*\.jpg$',
  17. },
  18. }, {
  19. 'url': 'http://www.dhm.de/filmarchiv/02-mapping-the-wall/peter-g/rolle-1/',
  20. 'md5': '09890226332476a3e3f6f2cb74734aa5',
  21. 'info_dict': {
  22. 'id': 'rolle-1',
  23. 'ext': 'flv',
  24. 'title': 'ROLLE 1',
  25. 'thumbnail': 're:^https?://.*\.jpg$',
  26. },
  27. }]
  28. def _real_extract(self, url):
  29. playlist_id = self._match_id(url)
  30. webpage = self._download_webpage(url, playlist_id)
  31. playlist_url = self._search_regex(
  32. r"file\s*:\s*'([^']+)'", webpage, 'playlist url')
  33. entries = self._extract_xspf_playlist(playlist_url, playlist_id)
  34. title = self._search_regex(
  35. [r'dc:title="([^"]+)"', r'<title> &raquo;([^<]+)</title>'],
  36. webpage, 'title').strip()
  37. description = self._html_search_regex(
  38. r'<p><strong>Description:</strong>(.+?)</p>',
  39. webpage, 'description', default=None)
  40. duration = parse_duration(self._search_regex(
  41. r'<em>Length\s*</em>\s*:\s*</strong>([^<]+)',
  42. webpage, 'duration', default=None))
  43. entries[0].update({
  44. 'title': title,
  45. 'description': description,
  46. 'duration': duration,
  47. })
  48. return self.playlist_result(entries, playlist_id)