]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/planetmarathi.py
1 from .common
import InfoExtractor
8 class PlanetMarathiIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?planetmarathi\.com/titles/(?P<id>[^/#&?$]+)'
11 'url': 'https://www.planetmarathi.com/titles/ek-unad-divas',
12 'playlist_mincount': 2,
14 'id': 'ek-unad-divas',
18 'id': 'ASSETS-MOVIE-ASSET-01_ek-unad-divas',
20 'title': 'ek unad divas',
21 'alt_title': 'चित्रपट',
22 'description': 'md5:41c7ed6b041c2fea9820a3f3125bd881',
23 'season_number': None,
26 'upload_date': '20210829',
30 'url': 'https://www.planetmarathi.com/titles/baap-beep-baap-season-1',
31 'playlist_mincount': 10,
33 'id': 'baap-beep-baap-season-1',
37 'id': 'ASSETS-CHARACTER-PROFILE-SEASON-01-ASSET-01_baap-beep-baap-season-1',
39 'title': 'Manohar Kanhere',
40 'alt_title': 'मनोहर कान्हेरे',
41 'description': 'md5:285ed45d5c0ab5522cac9a043354ebc6',
45 'upload_date': '20210829',
47 }] # Trailers, Episodes, other Character profiles skipped
50 def _real_extract(self
, url
):
51 id = self
._match
_id
(url
)
53 json_data
= self
._download
_json
(f
'https://www.planetmarathi.com/api/v1/titles/{id}/assets', id)['assets']
54 for asset
in json_data
:
55 asset_title
= asset
['mediaAssetName']['en']
56 if asset_title
== 'Movie':
57 asset_title
= id.replace('-', ' ')
58 asset_id
= f
'{asset["sk"]}_{id}'.replace('#', '-')
59 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(asset
['mediaAssetURL'], asset_id
)
60 self
._sort
_formats
(formats
)
64 'alt_title': try_get(asset
, lambda x
: x
['mediaAssetName']['mr']),
65 'description': try_get(asset
, lambda x
: x
['mediaAssetDescription']['en']),
66 'season_number': asset
.get('mediaAssetSeason'),
67 'episode_number': asset
.get('mediaAssetIndexForAssetType'),
68 'duration': asset
.get('mediaAssetDurationInSeconds'),
69 'upload_date': unified_strdate(asset
.get('created')),
71 'subtitles': subtitles
,
73 return self
.playlist_result(entries
, playlist_id
=id)