]>
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>[^/]+)\.html'
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:http://.*[.]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,
34 def _real_extract(self
, url
):
35 video_id
= self
._match
_id
(url
)
37 webpage
= self
._download
_webpage
(url
, video_id
)
39 title
= self
._og
_search
_title
(webpage
)
41 def extract_json(attr
, name
, fatal
=True):
42 return self
._parse
_json
(
44 r
'\b%s=(["\'])(?P
<json
>(?
!\
1).+?
)\
1' % attr, webpage,
45 name, group='json
', fatal=fatal) or '{}',
46 video_id, transform_source=unescapeHTML, fatal=fatal)
48 quality_data = extract_json('data
-quality
', 'formats
')
51 for format_id, url in quality_data.items():
54 'format_id
': format_id,
55 'height
': int_or_none(format_id.rstrip('p
')),
57 self._sort_formats(formats)
59 description = self._og_search_description(webpage)
60 thumbnail = self._og_search_thumbnail(
61 webpage, default=None) or self._html_search_regex(
62 r'\bdata
-poster
=(["\'])(?P<url>(?!\1).+?)\1', webpage,
63 'thumbnail', group='url')
65 share_params = extract_json(
66 'data-share-params', 'share params', fatal=False)
67 if isinstance(share_params, dict):
68 video_id = share_params.get('id') or video_id
73 'description': description,
74 'thumbnail': thumbnail,