1 from .common
import InfoExtractor
8 class TV2HuIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?tv2play\.hu/(?!szalag/)(?P<id>[^#&?]+)'
12 'url': 'https://tv2play.hu/mintaapak/mintaapak_213_epizod_resz',
16 'title': 'Mintaapák - 213. epizód',
17 'series': 'Mintaapák',
19 'description': 'md5:7350147e75485a59598e806c47967b07',
20 'thumbnail': r
're:^https?://.*\.jpg$',
21 'release_date': '20210825',
22 'episode_number': 213,
25 'skip_download': True,
28 'url': 'https://tv2play.hu/taxi_2',
29 'md5': '585e58e2e090f34603804bb2c48e98d8',
36 'description': 'md5:47762155dc9a50241797ded101b1b08c',
37 'thumbnail': r
're:^https?://.*\.jpg$',
38 'release_date': '20210118',
41 'skip_download': True,
45 def _real_extract(self
, url
):
46 video_id
= self
._match
_id
(url
)
47 json_data
= self
._download
_json
(f
'https://tv2play.hu/api/search/{video_id}', video_id
)
49 if json_data
['contentType'] == 'showpage':
50 ribbon_ids
= traverse_obj(json_data
, ('pages', ..., 'tabs', ..., 'ribbonIds'), get_all
=False, expected_type
=list)
51 entries
= [self
.url_result(f
'https://tv2play.hu/szalag/{ribbon_id}',
52 ie
=TV2HuSeriesIE
.ie_key(), video_id
=ribbon_id
) for ribbon_id
in ribbon_ids
]
53 return self
.playlist_result(entries
, playlist_id
=video_id
)
54 elif json_data
['contentType'] != 'video':
55 raise UnsupportedError(url
)
57 video_id
= str(json_data
['id'])
58 player_id
= json_data
.get('playerId')
59 series_json
= json_data
.get('seriesInfo', {})
61 video_json_url
= self
._download
_json
(f
'https://tv2play.hu/api/streaming-url?playerId={player_id}', video_id
)['url']
62 video_json
= self
._download
_json
(video_json_url
, video_id
)
63 m3u8_url
= self
._proto
_relative
_url
(traverse_obj(video_json
, ('bitrates', 'hls')))
64 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(m3u8_url
, video_id
)
68 'title': json_data
['title'],
69 'series': json_data
.get('seriesTitle'),
70 'duration': json_data
.get('length'),
71 'description': json_data
.get('description'),
72 'thumbnail': 'https://tv2play.hu' + json_data
.get('thumbnailUrl'),
73 'release_date': json_data
.get('uploadedAt').replace('.', ''),
74 'season_number': series_json
.get('seasonNr'),
75 'episode_number': series_json
.get('episodeNr'),
77 'subtitles': subtitles
,
81 class TV2HuSeriesIE(InfoExtractor
):
82 IE_NAME
= 'tv2playseries.hu'
83 _VALID_URL
= r
'https?://(?:www\.)?tv2play\.hu/szalag/(?P<id>[^#&?]+)'
86 'url': 'https://tv2play.hu/szalag/59?rendezes=nepszeruseg',
87 'playlist_mincount': 284,
93 def _real_extract(self
, url
):
94 playlist_id
= self
._match
_id
(url
)
95 json_data
= self
._download
_json
(f
'https://tv2play.hu/api/ribbons/{playlist_id}/0?size=100000', playlist_id
)
97 for card
in json_data
.get('cards', []):
98 video_id
= card
.get('slug')
100 entries
.append(self
.url_result(
101 f
'https://tv2play.hu/{video_id}', TV2HuIE
, video_id
))
103 return self
.playlist_result(entries
, playlist_id
=playlist_id
)