[cleanup] Make more playlist entries lazy (#11763)
[yt-dlp.git] / yt_dlp / extractor / dbtv.py
blob795fbacc417e4fbd413d0bed35014972f4b69e19
1 from .common import InfoExtractor
4 class DBTVIE(InfoExtractor):
5 _VALID_URL = r'https?://(?:www\.)?dagbladet\.no/video/(?:(?:embed|(?P<display_id>[^/]+))/)?(?P<id>[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8})'
6 _EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?dagbladet\.no/video/embed/(?:[0-9A-Za-z_-]{11}|[a-zA-Z0-9]{8}).*?)\1']
7 _TESTS = [{
8 'url': 'https://www.dagbladet.no/video/PynxJnNWChE/',
9 'md5': 'b8f850ba1860adbda668d367f9b77699',
10 'info_dict': {
11 'id': 'PynxJnNWChE',
12 'ext': 'mp4',
13 'title': 'Skulle teste ut fornøyelsespark, men kollegaen var bare opptatt av bikinikroppen',
14 'description': 'md5:49cc8370e7d66e8a2ef15c3b4631fd3f',
15 'thumbnail': r're:https?://.*\.jpg',
16 'upload_date': '20160916',
17 'duration': 69,
18 'uploader_id': 'UCk5pvsyZJoYJBd7_oFPTlRQ',
19 'uploader': 'Dagbladet',
21 'add_ie': ['Youtube'],
22 }, {
23 'url': 'https://www.dagbladet.no/video/embed/xlGmyIeN9Jo/?autoplay=false',
24 'only_matching': True,
25 }, {
26 'url': 'https://www.dagbladet.no/video/truer-iran-bor-passe-dere/PalfB2Cw',
27 'only_matching': True,
30 def _real_extract(self, url):
31 display_id, video_id = self._match_valid_url(url).groups()
32 info = {
33 '_type': 'url_transparent',
34 'id': video_id,
35 'display_id': display_id,
37 if len(video_id) == 11:
38 info.update({
39 'url': video_id,
40 'ie_key': 'Youtube',
42 else:
43 info.update({
44 'url': 'jwplatform:' + video_id,
45 'ie_key': 'JWPlatform',
47 return info