4 from .common
import InfoExtractor
6 compat_urllib_parse_unquote
,
11 class MediaKlikkIE(InfoExtractor
):
12 _VALID_URL
= r
'''(?x)https?://(?:www\.)?
13 (?:mediaklikk|m4sport|hirado|petofilive)\.hu/.*?(?:videok?|cikk)/
14 (?:(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/(?P<day>[0-9]{1,2})/)?
18 # mediaklikk. date in html.
19 'url': 'https://mediaklikk.hu/video/hazajaro-delnyugat-bacska-a-duna-menten-palankatol-doroszloig/',
22 'title': 'Hazajáró, DÉLNYUGAT-BÁCSKA – A Duna mentén Palánkától Doroszlóig',
24 'upload_date': '20210901',
25 'thumbnail': 'http://mediaklikk.hu/wp-content/uploads/sites/4/2014/02/hazajarouj_JO.jpg'
29 'url': 'https://m4sport.hu/video/2021/08/30/gyemant-liga-parizs/',
32 'title': 'Gyémánt Liga, Párizs',
34 'upload_date': '20210830',
35 'thumbnail': 'http://m4sport.hu/wp-content/uploads/sites/4/2021/08/vlcsnap-2021-08-30-18h21m20s10-1024x576.jpg'
38 # m4sport with *video/ url and no date
39 'url': 'https://m4sport.hu/bl-video/real-madrid-chelsea-1-1/',
42 'title': 'Real Madrid - Chelsea 1-1',
44 'thumbnail': 'http://m4sport.hu/wp-content/uploads/sites/4/2021/04/Sequence-01.Still001-1024x576.png'
48 'url': 'https://hirado.hu/videok/felteteleket-szabott-a-fovaros/',
51 'title': 'Feltételeket szabott a főváros',
53 'thumbnail': 'http://hirado.hu/wp-content/uploads/sites/4/2021/09/vlcsnap-2021-09-01-20h20m37s165.jpg'
57 'url': 'https://petofilive.hu/video/2021/06/07/tha-shudras-az-akusztikban/',
60 'title': 'Tha Shudras az Akusztikban',
62 'upload_date': '20210607',
63 'thumbnail': 'http://petofilive.hu/wp-content/uploads/sites/4/2021/06/vlcsnap-2021-06-07-22h14m23s915-1024x576.jpg'
67 def _real_extract(self
, url
):
68 mobj
= self
._match
_valid
_url
(url
)
69 display_id
= mobj
.group('id')
70 webpage
= self
._download
_webpage
(url
, display_id
)
72 player_data_str
= self
._html
_search
_regex
(
73 r
'mtva_player_manager\.player\(document.getElementById\(.*\),\s?(\{.*\}).*\);', webpage
, 'player data')
74 player_data
= self
._parse
_json
(player_data_str
, display_id
, compat_urllib_parse_unquote
)
75 video_id
= compat_str(player_data
['contentId'])
76 title
= player_data
.get('title') or self
._og
_search
_title
(webpage
, fatal
=False) or \
77 self
._html
_search
_regex
(r
'<h\d+\b[^>]+\bclass="article_title">([^<]+)<', webpage
, 'title')
79 upload_date
= unified_strdate(
80 '%s-%s-%s' % (mobj
.group('year'), mobj
.group('month'), mobj
.group('day')))
82 upload_date
= unified_strdate(self
._html
_search
_regex
(
83 r
'<p+\b[^>]+\bclass="article_date">([^<]+)<', webpage
, 'upload date', default
=None))
85 player_data
['video'] = player_data
.pop('token')
86 player_page
= self
._download
_webpage
('https://player.mediaklikk.hu/playernew/player.php', video_id
, query
=player_data
)
87 playlist_url
= self
._proto
_relative
_url
(compat_urllib_parse_unquote(
88 self
._html
_search
_regex
(r
'\"file\":\s*\"(\\?/\\?/.*playlist\.m3u8)\"', player_page
, 'playlist_url')).replace('\\/', '/'))
90 formats
= self
._extract
_wowza
_formats
(
91 playlist_url
, video_id
, skip_protocols
=['f4m', 'smil', 'dash'])
96 'display_id': display_id
,
98 'upload_date': upload_date
,
99 'thumbnail': player_data
.get('bgImage') or self
._og
_search
_thumbnail
(webpage
)