]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dumpert.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_request
8 from ..utils
import qualities
11 class DumpertIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?dumpert\.nl/mediabase/(?P<id>[0-9]+/[0-9a-zA-Z]+)'
14 'url': 'http://www.dumpert.nl/mediabase/6646981/951bc60f/',
15 'md5': '1b9318d7d5054e7dcb9dc7654f21d643',
17 'id': '6646981/951bc60f',
19 'title': 'Ik heb nieuws voor je',
20 'description': 'Niet schrikken hoor',
21 'thumbnail': 're:^https?://.*\.jpg$',
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
28 req
= compat_urllib_request
.Request(url
)
29 req
.add_header('Cookie', 'nsfw=1; cpc=10')
30 webpage
= self
._download
_webpage
(req
, video_id
)
32 files_base64
= self
._search
_regex
(
33 r
'data-files="([^"]+)"', webpage
, 'data files')
35 files
= self
._parse
_json
(
36 base64
.b64decode(files_base64
.encode('utf-8')).decode('utf-8'),
39 quality
= qualities(['flv', 'mobile', 'tablet', '720p'])
43 'format_id': format_id
,
44 'quality': quality(format_id
),
45 } for format_id
, video_url
in files
.items() if format_id
!= 'still']
46 self
._sort
_formats
(formats
)
48 title
= self
._html
_search
_meta
(
49 'title', webpage
) or self
._og
_search
_title
(webpage
)
50 description
= self
._html
_search
_meta
(
51 'description', webpage
) or self
._og
_search
_description
(webpage
)
52 thumbnail
= files
.get('still') or self
._og
_search
_thumbnail
(webpage
)
57 'description': description
,
58 'thumbnail': thumbnail
,