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