mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-06 10:59:36 +02:00
[extractor/NovaPlay] Fix extractor (#4415)
Closes #4439 Authored by: Bojidarist
This commit is contained in:
parent
97d9c79e92
commit
aeaf905e22
@ -6,44 +6,54 @@ class NovaPlayIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
|
_VALID_URL = r'https://play.nova\.bg/video/.*/(?P<id>\d+)'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'https://play.nova.bg/video/bratya/season-3/bratq-2021-10-08/548677',
|
'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-sybudi-se-sat/606627',
|
||||||
'md5': 'b1127a84e61bed1632b7c2ca9cbb4153',
|
'md5': 'd79dff2d09d196c595a7290f48e33399',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '548677',
|
'id': '606627',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Братя',
|
'title': 'Събуди се - събота по NOVA (23.07.2022)',
|
||||||
'alt_title': 'bratya/season-3/bratq-2021-10-08',
|
'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-sybudi-se-sat',
|
||||||
'duration': 1603.0,
|
'duration': 29.0,
|
||||||
'timestamp': 1633724150,
|
'timestamp': 1658491547,
|
||||||
'upload_date': '20211008',
|
'upload_date': '20220722',
|
||||||
'thumbnail': 'https://nbg-img.fite.tv/img/548677_460x260.jpg',
|
'thumbnail': 'https://nbg-img.fite.tv/img/606627_460x260.jpg',
|
||||||
'description': 'Сезон 3 Епизод 25'
|
'description': '29 сек',
|
||||||
|
'view_count': False
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'https://play.nova.bg/video/igri-na-volqta/season-3/igri-na-volqta-2021-09-20-1/548227',
|
'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609',
|
||||||
'md5': '5fd61b8ecbe582fc021019d570965d58',
|
'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '548227',
|
'id': '606609',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Игри на волята: България (20.09.2021) - част 1',
|
'title': 'Черешката на тортата - тази вечер по NOVA (22.07.2022)',
|
||||||
'alt_title': 'gri-na-volqta/season-3/igri-na-volqta-2021-09-20-1',
|
'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi',
|
||||||
'duration': 4060.0,
|
'duration': 29.0,
|
||||||
'timestamp': 1632167564,
|
'timestamp': 1658476303,
|
||||||
'upload_date': '20210920',
|
'upload_date': '20220722',
|
||||||
'thumbnail': 'https://nbg-img.fite.tv/img/548227_460x260.jpg',
|
'thumbnail': 'https://nbg-img.fite.tv/img/606609_460x260.jpg',
|
||||||
'description': 'Сезон 3 Епизод 13'
|
'description': '29 сек',
|
||||||
|
'view_count': False
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
_access_token = None
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
self._access_token = self._access_token or self._download_json(
|
||||||
|
'https://play.nova.bg/api/client', None, note='Fetching access token')['accessToken']
|
||||||
video_props = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['video']
|
video_props = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['video']
|
||||||
m3u8_url = self._download_json(
|
m3u8_url = self._download_json(
|
||||||
f'https://nbg-api.fite.tv/api/v2/videos/{video_id}/streams',
|
f'https://nbg-api.fite.tv/api/v2/videos/{video_id}/streams',
|
||||||
video_id, headers={'x-flipps-user-agent': 'Flipps/75/9.7'})[0]['url']
|
video_id, headers={
|
||||||
|
'x-flipps-user-agent': 'Flipps/75/9.7',
|
||||||
|
'x-flipps-version': '2022-05-17',
|
||||||
|
'Authorization': f'Bearer {self._access_token}'
|
||||||
|
})[0]['links']['play']['href']
|
||||||
formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', m3u8_id='hls')
|
formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', m3u8_id='hls')
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user