]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/novaplay.py
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 сек',
25 'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609',
26 'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3',
30 'title': 'Черешката на тортата - тази вечер по NOVA (22.07.2022)',
31 'alt_title': 'ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi',
33 'timestamp': 1658476303,
34 'upload_date': '20220722',
35 'thumbnail': 'https://nbg-img.fite.tv/img/606609_460x260.jpg',
36 'description': '29 сек',
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
46 webpage
= self
._download
_webpage
(url
, video_id
)
47 self
._access
_token
= self
._access
_token
or self
._download
_json
(
48 'https://play.nova.bg/api/client', None, note
='Fetching access token')['accessToken']
49 video_props
= self
._search
_nextjs
_data
(webpage
, video_id
)['props']['pageProps']['video']
50 m3u8_url
= self
._download
_json
(
51 f
'https://nbg-api.fite.tv/api/v2/videos/{video_id}/streams',
53 'x-flipps-user-agent': 'Flipps/75/9.7',
54 'x-flipps-version': '2022-05-17',
55 'Authorization': f
'Bearer {self._access_token}'
56 })[0]['links']['play']['href']
57 formats
= self
._extract
_m
3u8_formats
(m3u8_url
, video_id
, 'mp4', m3u8_id
='hls')
58 self
._sort
_formats
(formats
)
62 'title': video_props
['title'],
63 'alt_title': video_props
.get('slug'),
64 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
65 'description': self
._og
_search
_description
(webpage
),
67 'duration': parse_duration(video_props
['duration']),
68 'timestamp': parse_iso8601(video_props
['published_at']),
69 'view_count': int_or_none(video_props
['view_count']),