]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/kinopoisk.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class KinoPoiskIE(InfoExtractor
):
12 _GEO_COUNTRIES
= ['RU']
13 _VALID_URL
= r
'https?://(?:www\.)?kinopoisk\.ru/film/(?P<id>\d+)'
15 'url': 'https://www.kinopoisk.ru/film/81041/watch/',
16 'md5': '4f71c80baea10dfa54a837a46111d326',
20 'title': 'Алеша попович и тугарин змей',
21 'description': 'md5:43787e673d68b805d0aa1df5a5aea701',
22 'thumbnail': r
're:^https?://.*',
27 'url': 'https://www.kinopoisk.ru/film/81041',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
34 webpage
= self
._download
_webpage
(
35 'https://ott-widget.kinopoisk.ru/v1/kp/', video_id
,
36 query
={'kpId': video_id}
)
38 data
= self
._parse
_json
(
40 r
'(?s)<script[^>]+\btype=["\']application
/json
[^
>]+>(.+?
)<',
44 film = data['filmStatus
']
45 title = film.get('title
') or film['originalTitle
']
47 formats = self._extract_m3u8_formats(
48 data['playlistEntity
']['uri
'], video_id, 'mp4
',
49 entry_protocol='m3u8_native
', m3u8_id='hls
')
50 self._sort_formats(formats)
52 description = dict_get(
53 film, ('descriptscription
', 'description
',
54 'shortDescriptscription
', 'shortDescription
'))
55 thumbnail = film.get('coverUrl
') or film.get('posterUrl
')
56 duration = int_or_none(film.get('duration
'))
57 age_limit = int_or_none(film.get('restrictionAge
'))
62 'description
': description,
63 'thumbnail
': thumbnail,
65 'age_limit
': age_limit,