]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/npo.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
11 class NPOIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://www\.npo\.nl/[^/]+/[^/]+/(?P<id>[^/?]+)'
16 'url': 'http://www.npo.nl/nieuwsuur/22-06-2014/VPWON_1220719',
17 'md5': '4b3f9c429157ec4775f2c9cb7b911016',
19 'id': 'VPWON_1220719',
22 'description': 'Dagelijks tussen tien en elf: nieuws, sport en achtergronden.',
23 'upload_date': '20140622',
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
31 metadata
= self
._download
_json
(
32 'http://e.omroep.nl/metadata/aflevering/%s' % video_id
,
34 # We have to remove the javascript callback
35 transform_source
=lambda j
: re
.sub(r
'parseMetadata\((.*?)\);\n//epc', r
'\1', j
)
37 token_page
= self
._download
_webpage
(
38 'http://ida.omroep.nl/npoplayer/i.js',
40 note
='Downloading token'
42 token
= self
._search
_regex
(r
'npoplayer.token = "(.+?)"', token_page
, 'token')
43 streams_info
= self
._download
_json
(
44 'http://ida.omroep.nl/odi/?prid=%s&puboptions=h264_std&adaptive=yes&token=%s' % (video_id
, token
),
48 stream_info
= self
._download
_json
(
49 streams_info
['streams'][0] + '&type=json',
51 'Downloading stream info'
56 'title': metadata
['titel'],
58 'url': stream_info
['url'],
59 'description': metadata
['info'],
60 'thumbnail': metadata
['images'][-1]['url'],
61 'upload_date': unified_strdate(metadata
['gidsdatum']),