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