+
+
+class ShahidShowIE(ShahidBaseIE):
+ _VALID_URL = r'https?://shahid\.mbc\.net/ar/(?:show|serie)s/[^/]+/(?:show|series)-(?P<id>\d+)'
+ _TESTS = [{
+ 'url': 'https://shahid.mbc.net/ar/shows/%D8%B1%D8%A7%D9%85%D8%B2-%D9%82%D8%B1%D8%B4-%D8%A7%D9%84%D8%A8%D8%AD%D8%B1/show-79187',
+ 'info_dict': {
+ 'id': '79187',
+ 'title': 'رامز قرش البحر',
+ 'description': 'md5:c88fa7e0f02b0abd39d417aee0d046ff',
+ },
+ 'playlist_mincount': 32,
+ }, {
+ 'url': 'https://shahid.mbc.net/ar/series/How-to-live-Longer-(The-Big-Think)/series-291861',
+ 'only_matching': True
+ }]
+ _PAGE_SIZE = 30
+
+ def _real_extract(self, url):
+ show_id = self._match_id(url)
+
+ product = self._call_api(
+ 'playableAsset', show_id, {'showId': show_id})['productModel']
+ playlist = product['playlist']
+ playlist_id = playlist['id']
+ show = product.get('show', {})
+
+ def page_func(page_num):
+ playlist = self._call_api(
+ 'product/playlist', show_id, {
+ 'playListId': playlist_id,
+ 'pageNumber': page_num,
+ 'pageSize': 30,
+ 'sorts': [{
+ 'order': 'DESC',
+ 'type': 'SORTDATE'
+ }],
+ })
+ for product in playlist.get('productList', {}).get('products', []):
+ product_url = product.get('productUrl', []).get('url')
+ if not product_url:
+ continue
+ yield self.url_result(
+ product_url, 'Shahid',
+ str_or_none(product.get('id')),
+ product.get('title'))
+
+ entries = InAdvancePagedList(
+ page_func,
+ math.ceil(playlist['count'] / self._PAGE_SIZE),
+ self._PAGE_SIZE)
+
+ return self.playlist_result(
+ entries, show_id, show.get('title'), show.get('description'))