]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvn24.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class TVN24IE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:(?:[^/]+)\.)?tvn24(?:bis)?\.pl/(?:[^/]+/)*(?P<id>[^/]+)'
15 'url': 'http://www.tvn24.pl/wiadomosci-z-kraju,3/oredzie-artura-andrusa,702428.html',
16 'md5': 'fbdec753d7bc29d96036808275f2130c',
20 'title': '"Święta mają być wesołe, dlatego, ludziska, wszyscy pod jemiołę"',
21 'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości Szkła kontaktowego.',
22 'thumbnail': 're:https?://.*[.]jpeg',
26 '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',
30 'title': 'Pnącza, ptaki i iglaki (odc. 691 /HGTV odc. 29)',
31 'thumbnail': 're:https?://.*',
34 'skip_download': True,
37 'url': 'http://fakty.tvn24.pl/ogladaj-online,60/53-konferencja-bezpieczenstwa-w-monachium,716431.html',
38 'only_matching': True,
40 'url': 'http://sport.tvn24.pl/pilka-nozna,105/ligue-1-kamil-glik-rozcial-glowe-monaco-tylko-remisuje-z-bastia,716522.html',
41 'only_matching': True,
43 'url': 'http://tvn24bis.pl/poranek,146,m/gen-koziej-w-tvn24-bis-wracamy-do-czasow-zimnej-wojny,715660.html',
44 'only_matching': True,
46 'url': 'https://www.tvn24.pl/magazyn-tvn24/angie-w-jednej-czwartej-polka-od-szarej-myszki-do-cesarzowej-europy,119,2158',
47 'only_matching': True,
50 def _real_extract(self
, url
):
51 display_id
= self
._match
_id
(url
)
53 webpage
= self
._download
_webpage
(url
, display_id
)
55 title
= self
._og
_search
_title
(
56 webpage
, default
=None) or self
._search
_regex
(
57 r
'<h\d+[^>]+class=["\']magazineItemHeader
[^
>]+>(.+?
)</h
',
60 def extract_json(attr, name, default=NO_DEFAULT, fatal=True):
61 return self._parse_json(
63 r'\b%s=(["\'])(?P<json>(?!\1).+?)\1' % attr, webpage,
64 name, group='json', default=default, fatal=fatal) or '{}',
65 display_id, transform_source=unescapeHTML, fatal=fatal)
67 quality_data = extract_json('data-quality', 'formats')
70 for format_id, url in quality_data.items():
73 'format_id': format_id,
74 'height': int_or_none(format_id.rstrip('p')),
76 self._sort_formats(formats)
78 description = self._og_search_description(webpage, default=None)
79 thumbnail = self._og_search_thumbnail(
80 webpage, default=None) or self._html_search_regex(
81 r'\bdata-poster=(["\'])(?P
<url
>(?
!\
1).+?
)\
1', webpage,
82 'thumbnail
', group='url
')
86 share_params = extract_json(
87 'data
-share
-params
', 'share params
', default=None)
88 if isinstance(share_params, dict):
89 video_id = share_params.get('id')
92 video_id = self._search_regex(
93 r'data
-vid
-id=["\'](\d+)', webpage, 'video id',
94 default=None) or self._search_regex(
95 r',(\d+)\.html', url, 'video id', default=display_id)
100 'description': description,
101 'thumbnail': thumbnail,