]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dumpert.py
c9fc9b5a9df65cd8681ce8e0933473ea9658202d
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
14 class DumpertIE(InfoExtractor
):
15 _VALID_URL
= r
'(?P<protocol>https?)://(?:www\.)?dumpert\.nl/(?:mediabase|embed)/(?P<id>[0-9]+/[0-9a-zA-Z]+)'
17 'url': 'http://www.dumpert.nl/mediabase/6646981/951bc60f/',
18 'md5': '1b9318d7d5054e7dcb9dc7654f21d643',
20 'id': '6646981/951bc60f',
22 'title': 'Ik heb nieuws voor je',
23 'description': 'Niet schrikken hoor',
24 'thumbnail': r
're:^https?://.*\.jpg$',
27 'url': 'http://www.dumpert.nl/embed/6675421/dc440fe7/',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
34 protocol
= mobj
.group('protocol')
36 url
= '%s://www.dumpert.nl/mediabase/%s' % (protocol
, video_id
)
37 req
= sanitized_Request(url
)
38 req
.add_header('Cookie', 'nsfw=1; cpc=10')
39 webpage
= self
._download
_webpage
(req
, video_id
)
41 files_base64
= self
._search
_regex
(
42 r
'data-files="([^"]+)"', webpage
, 'data files')
44 files
= self
._parse
_json
(
45 base64
.b64decode(files_base64
.encode('utf-8')).decode('utf-8'),
48 quality
= qualities(['flv', 'mobile', 'tablet', '720p'])
52 'format_id': format_id
,
53 'quality': quality(format_id
),
54 } for format_id
, video_url
in files
.items() if format_id
!= 'still']
55 self
._sort
_formats
(formats
)
57 title
= self
._html
_search
_meta
(
58 'title', webpage
) or self
._og
_search
_title
(webpage
)
59 description
= self
._html
_search
_meta
(
60 'description', webpage
) or self
._og
_search
_description
(webpage
)
61 thumbnail
= files
.get('still') or self
._og
_search
_thumbnail
(webpage
)
66 'description': description
,
67 'thumbnail': thumbnail
,