]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/dbtv.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[yt-dlp.git] / yt_dlp / extractor / dbtv.py
CommitLineData
f063a04f 1from .common import InfoExtractor
f063a04f 2
4d067a58 3
f063a04f 4class DBTVIE(InfoExtractor):
272355c1 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})'
bfd973ec 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']
7ac40086 7 _TESTS = [{
272355c1
RA
8 'url': 'https://www.dagbladet.no/video/PynxJnNWChE/',
9 'md5': 'b8f850ba1860adbda668d367f9b77699',
4d067a58 10 'info_dict': {
272355c1 11 'id': 'PynxJnNWChE',
4d067a58
S
12 'ext': 'mp4',
13 'title': 'Skulle teste ut fornøyelsespark, men kollegaen var bare opptatt av bikinikroppen',
272355c1 14 'description': 'md5:49cc8370e7d66e8a2ef15c3b4631fd3f',
ec85ded8 15 'thumbnail': r're:https?://.*\.jpg',
272355c1
RA
16 'upload_date': '20160916',
17 'duration': 69,
18 'uploader_id': 'UCk5pvsyZJoYJBd7_oFPTlRQ',
19 'uploader': 'Dagbladet',
8a8590a6 20 },
add96eb9 21 'add_ie': ['Youtube'],
7ac40086 22 }, {
272355c1 23 'url': 'https://www.dagbladet.no/video/embed/xlGmyIeN9Jo/?autoplay=false',
7ac40086
S
24 'only_matching': True,
25 }, {
272355c1 26 'url': 'https://www.dagbladet.no/video/truer-iran-bor-passe-dere/PalfB2Cw',
8a8590a6 27 'only_matching': True,
7ac40086 28 }]
f063a04f 29
4d067a58 30 def _real_extract(self, url):
5ad28e7f 31 display_id, video_id = self._match_valid_url(url).groups()
272355c1 32 info = {
8a8590a6 33 '_type': 'url_transparent',
8a8590a6 34 'id': video_id,
4d067a58 35 'display_id': display_id,
4d067a58 36 }
272355c1
RA
37 if len(video_id) == 11:
38 info.update({
39 'url': video_id,
40 'ie_key': 'Youtube',
41 })
42 else:
43 info.update({
44 'url': 'jwplatform:' + video_id,
45 'ie_key': 'JWPlatform',
46 })
47 return info