1 from .common
import InfoExtractor
2 from ..aes
import aes_cbc_decrypt
, unpad_pkcs7
14 class ShemarooMeIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?shemaroome\.com/(?:movies|shows)/(?P<id>[^?#]+)'
17 'url': 'https://www.shemaroome.com/movies/dil-hai-tumhaara',
19 'id': 'dil-hai-tumhaara',
21 'title': 'Dil Hai Tumhaara',
22 'release_date': '20020906',
23 'thumbnail': r
're:^https?://.*\.jpg$',
24 'description': 'md5:2782c4127807103cf5a6ae2ca33645ce',
30 'url': 'https://www.shemaroome.com/shows/jurm-aur-jazbaat/laalach',
32 'id': 'jurm-aur-jazbaat_laalach',
35 'description': 'md5:92b79c2dcb539b0ab53f9fa5a048f53c',
36 'thumbnail': r
're:^https?://.*\.jpg$',
37 'release_date': '20210507',
42 'skip': 'Premium videos cannot be downloaded yet.'
44 'url': 'https://www.shemaroome.com/shows/jai-jai-jai-bajrang-bali/jai-jai-jai-bajrang-bali-episode-99',
46 'id': 'jai-jai-jai-bajrang-bali_jai-jai-jai-bajrang-bali-episode-99',
48 'title': 'Jai Jai Jai Bajrang Bali Episode 99',
49 'description': 'md5:850d127a18ee3f9529d7fbde2f49910d',
50 'thumbnail': r
're:^https?://.*\.jpg$',
51 'release_date': '20110101',
58 def _real_extract(self
, url
):
59 video_id
= self
._match
_id
(url
).replace('/', '_')
60 webpage
= self
._download
_webpage
(url
, video_id
)
61 title
= self
._search
_regex
(r
'id=\"ma_title\" value=\"([^\"]+)', webpage
, 'title')
62 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
63 content_def
= self
._search
_regex
(r
'id=\"content_definition\" value=\"([^\"]+)', webpage
, 'content_def')
64 catalog_id
= self
._search
_regex
(r
'id=\"catalog_id\" value=\"([^\"]+)', webpage
, 'catalog_id')
65 item_category
= self
._search
_regex
(r
'id=\"item_category\" value=\"([^\"]+)', webpage
, 'item_category')
66 content_id
= self
._search
_regex
(r
'id=\"content_id\" value=\"([^\"]+)', webpage
, 'content_id')
68 data
= f
'catalog_id={catalog_id}&content_id={content_id}&category={item_category}&content_def={content_def}'
69 data_json
= self
._download
_json
('https://www.shemaroome.com/users/user_all_lists', video_id
, data
=data
.encode())
70 if not data_json
.get('status'):
71 raise ExtractorError('Premium videos cannot be downloaded yet.', expected
=True)
72 url_data
= bytes_to_intlist(compat_b64decode(data_json
['new_play_url']))
73 key
= bytes_to_intlist(compat_b64decode(data_json
['key']))
75 m3u8_url
= unpad_pkcs7(intlist_to_bytes(aes_cbc_decrypt(url_data
, key
, iv
))).decode('ascii')
76 formats
, m3u8_subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(m3u8_url
, video_id
, fatal
=False, headers
={'stream_key': data_json['stream_key']}
)
77 self
._sort
_formats
(formats
)
79 release_date
= self
._html
_search
_regex
(
80 (r
'itemprop="uploadDate">\s*([\d-]+)', r
'id="release_date" value="([\d-]+)'),
81 webpage
, 'release date', fatal
=False)
84 sub_url
= data_json
.get('subtitle')
86 subtitles
.setdefault('EN', []).append({
87 'url': self
._proto
_relative
_url
(sub_url
),
89 subtitles
= self
._merge
_subtitles
(subtitles
, m3u8_subs
)
90 description
= self
._html
_search
_regex
(r
'(?s)>Synopsis(</.+?)</', webpage
, 'description', fatal
=False)
96 'thumbnail': thumbnail
,
97 'release_date': unified_strdate(release_date
),
98 'description': description
,
99 'subtitles': subtitles
,