]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dhm.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class DHMIE(InfoExtractor
):
11 IE_DESC
= 'Filmarchiv - Deutsches Historisches Museum'
12 _VALID_URL
= r
'https?://(?:www\.)?dhm\.de/filmarchiv/(?:[^/]+/)+(?P<id>[^/]+)'
15 'url': 'http://www.dhm.de/filmarchiv/die-filme/the-marshallplan-at-work-in-west-germany/',
16 'md5': '11c475f670209bf6acca0b2b7ef51827',
18 'id': 'the-marshallplan-at-work-in-west-germany',
20 'title': 'MARSHALL PLAN AT WORK IN WESTERN GERMANY, THE',
21 'description': 'md5:1fabd480c153f97b07add61c44407c82',
23 'thumbnail': 're:^https?://.*\.jpg$',
26 'url': 'http://www.dhm.de/filmarchiv/02-mapping-the-wall/peter-g/rolle-1/',
27 'md5': '09890226332476a3e3f6f2cb74734aa5',
32 'thumbnail': 're:^https?://.*\.jpg$',
36 def _real_extract(self
, url
):
37 video_id
= self
._match
_id
(url
)
39 webpage
= self
._download
_webpage
(url
, video_id
)
41 playlist_url
= self
._search
_regex
(
42 r
"file\s*:\s*'([^']+)'", webpage
, 'playlist url')
44 playlist
= self
._download
_xml
(playlist_url
, video_id
)
46 track
= playlist
.find(
47 './{http://xspf.org/ns/0/}trackList/{http://xspf.org/ns/0/}track')
49 video_url
= xpath_text(
50 track
, './{http://xspf.org/ns/0/}location',
51 'video url', fatal
=True)
52 thumbnail
= xpath_text(
53 track
, './{http://xspf.org/ns/0/}image',
56 title
= self
._search
_regex
(
57 [r
'dc:title="([^"]+)"', r
'<title> »([^<]+)</title>'],
58 webpage
, 'title').strip()
59 description
= self
._html
_search
_regex
(
60 r
'<p><strong>Description:</strong>(.+?)</p>',
61 webpage
, 'description', default
=None)
62 duration
= parse_duration(self
._search
_regex
(
63 r
'<em>Length\s*</em>\s*:\s*</strong>([^<]+)',
64 webpage
, 'duration', default
=None))
70 'description': description
,
72 'thumbnail': thumbnail
,