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