3 from .common
import InfoExtractor
4 from ..aes
import aes_cbc_decrypt_bytes
, unpad_pkcs7
11 class ShemarooMeIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?shemaroome\.com/(?:movies|shows)/(?P<id>[^?#]+)'
14 'url': 'https://www.shemaroome.com/movies/dil-hai-tumhaara',
16 'id': 'dil-hai-tumhaara',
18 'title': 'Dil Hai Tumhaara',
19 'release_date': '20020906',
20 'thumbnail': r
're:^https?://.*\.jpg$',
21 'description': 'md5:2782c4127807103cf5a6ae2ca33645ce',
24 'skip_download': True,
27 'url': 'https://www.shemaroome.com/shows/jurm-aur-jazbaat/laalach',
29 'id': 'jurm-aur-jazbaat_laalach',
32 'description': 'md5:92b79c2dcb539b0ab53f9fa5a048f53c',
33 'thumbnail': r
're:^https?://.*\.jpg$',
34 'release_date': '20210507',
37 'skip_download': True,
39 'skip': 'Premium videos cannot be downloaded yet.',
41 'url': 'https://www.shemaroome.com/shows/jai-jai-jai-bajrang-bali/jai-jai-jai-bajrang-bali-episode-99',
43 'id': 'jai-jai-jai-bajrang-bali_jai-jai-jai-bajrang-bali-episode-99',
45 'title': 'Jai Jai Jai Bajrang Bali Episode 99',
46 'description': 'md5:850d127a18ee3f9529d7fbde2f49910d',
47 'thumbnail': r
're:^https?://.*\.jpg$',
48 'release_date': '20110101',
51 'skip_download': True,
55 def _real_extract(self
, url
):
56 video_id
= self
._match
_id
(url
).replace('/', '_')
57 webpage
= self
._download
_webpage
(url
, video_id
)
58 title
= self
._search
_regex
(r
'id=\"ma_title\" value=\"([^\"]+)', webpage
, 'title')
59 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
60 content_def
= self
._search
_regex
(r
'id=\"content_definition\" value=\"([^\"]+)', webpage
, 'content_def')
61 catalog_id
= self
._search
_regex
(r
'id=\"catalog_id\" value=\"([^\"]+)', webpage
, 'catalog_id')
62 item_category
= self
._search
_regex
(r
'id=\"item_category\" value=\"([^\"]+)', webpage
, 'item_category')
63 content_id
= self
._search
_regex
(r
'id=\"content_id\" value=\"([^\"]+)', webpage
, 'content_id')
65 data
= f
'catalog_id={catalog_id}&content_id={content_id}&category={item_category}&content_def={content_def}'
66 data_json
= self
._download
_json
('https://www.shemaroome.com/users/user_all_lists', video_id
, data
=data
.encode())
67 if not data_json
.get('status'):
68 raise ExtractorError('Premium videos cannot be downloaded yet.', expected
=True)
69 url_data
= base64
.b64decode(data_json
['new_play_url'])
70 key
= base64
.b64decode(data_json
['key'])
72 m3u8_url
= unpad_pkcs7(aes_cbc_decrypt_bytes(url_data
, key
, iv
)).decode('ascii')
73 headers
= {'stream_key': data_json
['stream_key']}
74 formats
, m3u8_subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(m3u8_url
, video_id
, fatal
=False, headers
=headers
)
76 fmt
['http_headers'] = headers
78 release_date
= self
._html
_search
_regex
(
79 (r
'itemprop="uploadDate">\s*([\d-]+)', r
'id="release_date" value="([\d-]+)'),
80 webpage
, 'release date', fatal
=False)
83 sub_url
= data_json
.get('subtitle')
85 subtitles
.setdefault('EN', []).append({
86 'url': self
._proto
_relative
_url
(sub_url
),
88 subtitles
= self
._merge
_subtitles
(subtitles
, m3u8_subs
)
89 description
= self
._html
_search
_regex
(r
'(?s)>Synopsis(</.+?)</', webpage
, 'description', fatal
=False)
95 'thumbnail': thumbnail
,
96 'release_date': unified_strdate(release_date
),
97 'description': description
,
98 'subtitles': subtitles
,