]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dhm.py
   1 from __future__ 
import unicode_literals
 
   3 from .common 
import InfoExtractor
 
   4 from ..utils 
import parse_duration
 
   7 class DHMIE(InfoExtractor
): 
   8     IE_DESC 
= 'Filmarchiv - Deutsches Historisches Museum' 
   9     _VALID_URL 
= r
'https?://(?:www\.)?dhm\.de/filmarchiv/(?:[^/]+/)+(?P<id>[^/]+)' 
  12         'url': 'http://www.dhm.de/filmarchiv/die-filme/the-marshallplan-at-work-in-west-germany/', 
  13         'md5': '11c475f670209bf6acca0b2b7ef51827', 
  15             'id': 'the-marshallplan-at-work-in-west-germany', 
  17             'title': 'MARSHALL PLAN AT WORK IN WESTERN GERMANY, THE', 
  18             'description': 'md5:1fabd480c153f97b07add61c44407c82', 
  20             'thumbnail': r
're:^https?://.*\.jpg$', 
  23         'url': 'http://www.dhm.de/filmarchiv/02-mapping-the-wall/peter-g/rolle-1/', 
  24         'md5': '09890226332476a3e3f6f2cb74734aa5', 
  29             'thumbnail': r
're:^https?://.*\.jpg$', 
  33     def _real_extract(self
, url
): 
  34         playlist_id 
= self
._match
_id
(url
) 
  36         webpage 
= self
._download
_webpage
(url
, playlist_id
) 
  38         playlist_url 
= self
._search
_regex
( 
  39             r
"file\s*:\s*'([^']+)'", webpage
, 'playlist url') 
  41         entries 
= self
._extract
_xspf
_playlist
(playlist_url
, playlist_id
) 
  43         title 
= self
._search
_regex
( 
  44             [r
'dc:title="([^"]+)"', r
'<title> »([^<]+)</title>'], 
  45             webpage
, 'title').strip() 
  46         description 
= self
._html
_search
_regex
( 
  47             r
'<p><strong>Description:</strong>(.+?)</p>', 
  48             webpage
, 'description', default
=None) 
  49         duration 
= parse_duration(self
._search
_regex
( 
  50             r
'<em>Length\s*</em>\s*:\s*</strong>([^<]+)', 
  51             webpage
, 'duration', default
=None)) 
  55             'description': description
, 
  59         return self
.playlist_result(entries
, playlist_id
)