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,