1 from .common
import InfoExtractor
9 class TVN24IE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:(?!eurosport)[^/]+\.)?tvn24(?:bis)?\.pl/(?:[^/?#]+/)*(?P<id>[^/?#]+)'
13 'url': 'http://www.tvn24.pl/wiadomosci-z-kraju,3/oredzie-artura-andrusa,702428.html',
14 'md5': 'fbdec753d7bc29d96036808275f2130c',
18 'title': '"Święta mają być wesołe, dlatego, ludziska, wszyscy pod jemiołę"',
19 'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości Szkła kontaktowego.',
20 'thumbnail': 're:https?://.*[.]jpeg',
24 'url': 'https://tvnmeteo.tvn24.pl/magazyny/maja-w-ogrodzie,13/odcinki-online,1,4,1,0/pnacza-ptaki-i-iglaki-odc-691-hgtv-odc-29,1771763.html',
28 'title': 'Pnącza, ptaki i iglaki (odc. 691 /HGTV odc. 29)',
29 'thumbnail': 're:https?://.*',
32 'skip_download': True,
35 'url': 'http://fakty.tvn24.pl/ogladaj-online,60/53-konferencja-bezpieczenstwa-w-monachium,716431.html',
36 'only_matching': True,
38 'url': 'http://sport.tvn24.pl/pilka-nozna,105/ligue-1-kamil-glik-rozcial-glowe-monaco-tylko-remisuje-z-bastia,716522.html',
39 'only_matching': True,
41 'url': 'http://tvn24bis.pl/poranek,146,m/gen-koziej-w-tvn24-bis-wracamy-do-czasow-zimnej-wojny,715660.html',
42 'only_matching': True,
44 'url': 'https://www.tvn24.pl/magazyn-tvn24/angie-w-jednej-czwartej-polka-od-szarej-myszki-do-cesarzowej-europy,119,2158',
45 'only_matching': True,
48 def _real_extract(self
, url
):
49 display_id
= self
._match
_id
(url
)
51 webpage
= self
._download
_webpage
(url
, display_id
)
53 title
= self
._og
_search
_title
(
54 webpage
, default
=None) or self
._search
_regex
(
55 r
'<h\d+[^>]+class=["\']magazineItemHeader
[^
>]+>(.+?
)</h
',
58 def extract_json(attr, name, default=NO_DEFAULT, fatal=True):
59 return self._parse_json(
61 rf'\b{attr}
=(["\'])(?P<json>(?!\1).+?)\1', webpage,
62 name, group='json', default=default, fatal=fatal) or '{}',
63 display_id, transform_source=unescapeHTML, fatal=fatal)
65 quality_data = extract_json('data-quality', 'formats')
68 for format_id, url in quality_data.items():
71 'format_id': format_id,
72 'height': int_or_none(format_id.rstrip('p')),
75 description = self._og_search_description(webpage, default=None)
76 thumbnail = self._og_search_thumbnail(
77 webpage, default=None) or self._html_search_regex(
78 r'\bdata-poster=(["\'])(?P
<url
>(?
!\
1).+?
)\
1', webpage,
79 'thumbnail
', group='url
')
83 share_params = extract_json(
84 'data
-share
-params
', 'share params
', default=None)
85 if isinstance(share_params, dict):
86 video_id = share_params.get('id')
89 video_id = self._search_regex(
90 r'data
-vid
-id=["\'](\d+)', webpage, 'video id',
91 default=None) or self._search_regex(
92 r',(\d+)\.html', url, 'video id', default=display_id)
97 'description': description,
98 'thumbnail': thumbnail,