]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tvn24.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class TVN24IE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:(?:[^/]+)\.)?tvn24(?:bis)?\.pl/(?:[^/]+/)*(?P<id>[^/]+)'
14 'url': 'http://www.tvn24.pl/wiadomosci-z-kraju,3/oredzie-artura-andrusa,702428.html',
15 'md5': 'fbdec753d7bc29d96036808275f2130c',
19 'title': '"Święta mają być wesołe, dlatego, ludziska, wszyscy pod jemiołę"',
20 'description': 'Wyjątkowe orędzie Artura Andrusa, jednego z gości "Szkła kontaktowego".',
21 'thumbnail': 're:https?://.*[.]jpeg',
24 'url': 'http://fakty.tvn24.pl/ogladaj-online,60/53-konferencja-bezpieczenstwa-w-monachium,716431.html',
25 'only_matching': True,
27 'url': 'http://sport.tvn24.pl/pilka-nozna,105/ligue-1-kamil-glik-rozcial-glowe-monaco-tylko-remisuje-z-bastia,716522.html',
28 'only_matching': True,
30 'url': 'http://tvn24bis.pl/poranek,146,m/gen-koziej-w-tvn24-bis-wracamy-do-czasow-zimnej-wojny,715660.html',
31 'only_matching': True,
33 'url': 'https://www.tvn24.pl/magazyn-tvn24/angie-w-jednej-czwartej-polka-od-szarej-myszki-do-cesarzowej-europy,119,2158',
34 'only_matching': True,
37 def _real_extract(self
, url
):
38 video_id
= self
._match
_id
(url
)
40 webpage
= self
._download
_webpage
(url
, video_id
)
42 title
= self
._og
_search
_title
(webpage
)
44 def extract_json(attr
, name
, fatal
=True):
45 return self
._parse
_json
(
47 r
'\b%s=(["\'])(?P
<json
>(?
!\
1).+?
)\
1' % attr, webpage,
48 name, group='json
', fatal=fatal) or '{}',
49 video_id, transform_source=unescapeHTML, fatal=fatal)
51 quality_data = extract_json('data
-quality
', 'formats
')
54 for format_id, url in quality_data.items():
57 'format_id
': format_id,
58 'height
': int_or_none(format_id.rstrip('p
')),
60 self._sort_formats(formats)
62 description = self._og_search_description(webpage)
63 thumbnail = self._og_search_thumbnail(
64 webpage, default=None) or self._html_search_regex(
65 r'\bdata
-poster
=(["\'])(?P<url>(?!\1).+?)\1', webpage,
66 'thumbnail', group='url')
68 share_params = extract_json(
69 'data-share-params', 'share params', fatal=False)
70 if isinstance(share_params, dict):
71 video_id = share_params.get('id') or video_id
76 'description': description,
77 'thumbnail': thumbnail,