1 from .common
import InfoExtractor
7 from ..compat
import compat_urlparse
10 class DWIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?dw\.com/(?:[^/]+/)+(?:av|e)-(?P<id>\d+)'
15 'url': 'http://www.dw.com/en/intelligent-light/av-19112290',
16 'md5': 'fb9dfd9520811d3ece80f04befd73428',
20 'title': 'Intelligent light',
21 'description': 'md5:90e00d5881719f2a6a5827cb74985af1',
22 'upload_date': '20160605',
26 'url': 'http://www.dw.com/en/worldlink-my-business/av-19111941',
27 'md5': '2814c9a1321c3a51f8a7aeb067a360dd',
31 'title': 'WorldLink: My business',
32 'description': 'md5:bc9ca6e4e063361e21c920c53af12405',
33 'upload_date': '20160311',
36 # DW documentaries, only last for one or two weeks
37 'url': 'http://www.dw.com/en/documentaries-welcome-to-the-90s-2016-05-21/e-19220158-9798',
38 'md5': '56b6214ef463bfb9a3b71aeb886f3cf1',
42 'title': 'Welcome to the 90s – Hip Hop',
43 'description': 'Welcome to the 90s - The Golden Decade of Hip Hop',
44 'upload_date': '20160521',
46 'skip': 'Video removed',
49 def _real_extract(self
, url
):
50 media_id
= self
._match
_id
(url
)
51 webpage
= self
._download
_webpage
(url
, media_id
)
52 hidden_inputs
= self
._hidden
_inputs
(webpage
)
53 title
= hidden_inputs
['media_title']
54 media_id
= hidden_inputs
.get('media_id') or media_id
56 direct_url
= url_or_none(hidden_inputs
.get('file_name'))
58 formats
= [{'url': hidden_inputs['file_name']}
]
60 formats
= self
._extract
_smil
_formats
(
61 'http://www.dw.com/smil/v-%s' % media_id
, media_id
,
62 transform_source
=lambda s
: s
.replace(
63 'rtmp://tv-od.dw.de/flash/',
64 'http://tv-download.dw.de/dwtv_video/flv/'))
65 self
._sort
_formats
(formats
)
67 upload_date
= hidden_inputs
.get('display_date')
69 upload_date
= self
._html
_search
_regex
(
70 r
'<span[^>]+class="date">([0-9.]+)\s*\|', webpage
,
71 'upload date', default
=None)
72 upload_date
= unified_strdate(upload_date
)
77 'description': self
._og
_search
_description
(webpage
),
78 'thumbnail': hidden_inputs
.get('preview_image'),
79 'duration': int_or_none(hidden_inputs
.get('file_duration')),
80 'upload_date': upload_date
,
85 class DWArticleIE(InfoExtractor
):
86 IE_NAME
= 'dw:article'
87 _VALID_URL
= r
'https?://(?:www\.)?dw\.com/(?:[^/]+/)+a-(?P<id>\d+)'
89 'url': 'http://www.dw.com/en/no-hope-limited-options-for-refugees-in-idomeni/a-19111009',
90 'md5': '8ca657f9d068bbef74d6fc38b97fc869',
94 'title': 'The harsh life of refugees in Idomeni',
95 'description': 'md5:196015cc7e48ebf474db9399420043c7',
96 'upload_date': '20160310',
100 def _real_extract(self
, url
):
101 article_id
= self
._match
_id
(url
)
102 webpage
= self
._download
_webpage
(url
, article_id
)
103 hidden_inputs
= self
._hidden
_inputs
(webpage
)
104 media_id
= hidden_inputs
['media_id']
105 media_path
= self
._search
_regex
(r
'href="([^"]+av-%s)"\s+class="overlayLink"' % media_id
, webpage
, 'media url')
106 media_url
= compat_urlparse
.urljoin(url
, media_path
)
107 return self
.url_result(media_url
, 'DW', media_id
)