1 from .common
import InfoExtractor
2 from ..utils
import int_or_none
, parse_duration
, parse_iso8601
5 class NovaPlayIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://play\.nova\.bg/video/[^?#]+/(?P<id>\d+)'
9 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-sybudi-se-sat/606627',
10 'md5': 'd79dff2d09d196c595a7290f48e33399',
14 'title': 'Събуди се - събота по NOVA (23.07.2022)',
15 'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-sybudi-se-sat',
17 'timestamp': 1658491547,
18 'upload_date': '20220722',
19 'thumbnail': 'https://nbg-img.fite.tv/img/606627_460x260.jpg',
20 'description': '29 сек',
24 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609',
25 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3',
29 'title': 'Черешката на тортата - тази вечер по NOVA (22.07.2022)',
30 'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi',
32 'timestamp': 1658476303,
33 'upload_date': '20220722',
34 'thumbnail': 'https://nbg-img.fite.tv/img/606609_460x260.jpg',
35 'description': '29 сек',
42 def _real_extract(self
, url
):
43 video_id
= self
._match
_id
(url
)
44 webpage
= self
._download
_webpage
(url
, video_id
)
45 self
._access
_token
= self
._access
_token
or self
._download
_json
(
46 'https://play.nova.bg/api/client', None, note
='Fetching access token')['accessToken']
47 video_props
= self
._search
_nextjs
_data
(webpage
, video_id
)['props']['pageProps']['video']
48 m3u8_url
= self
._download
_json
(
49 f
'https://nbg-api.fite.tv/api/v2/videos/{video_id}/streams',
51 'x-flipps-user-agent': 'Flipps/75/9.7',
52 'x-flipps-version': '2022-05-17',
53 'Authorization': f
'Bearer {self._access_token}',
54 })[0]['links']['play']['href']
55 formats
= self
._extract
_m
3u8_formats
(m3u8_url
, video_id
, 'mp4', m3u8_id
='hls')
59 'title': video_props
['title'],
60 'alt_title': video_props
.get('slug'),
61 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
62 'description': self
._og
_search
_description
(webpage
),
64 'duration': parse_duration(video_props
['duration']),
65 'timestamp': parse_iso8601(video_props
['published_at']),
66 'view_count': int_or_none(video_props
['view_count']),