- creator = try_get(
- mediainfo, lambda x: x['brand-info']['publisher'], compat_str)
- category = try_get(
- mediainfo, lambda x: x['brand-info']['category'], compat_str)
- categories = [category] if category else None
+ fields = []
+ for templ, repls in (('tvSeason%sNumber', ('', 'Episode')), ('mediasetprogram$%s', ('brandTitle', 'numberOfViews', 'publishInfo'))):
+ fields.extend(templ % repl for repl in repls)
+ feed_data = self._download_json(
+ 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs/guid/-/' + guid,
+ guid, fatal=False, query={'fields': ','.join(fields)})
+ if feed_data:
+ publish_info = feed_data.get('mediasetprogram$publishInfo') or {}
+ info.update({
+ 'episode_number': int_or_none(feed_data.get('tvSeasonEpisodeNumber')),
+ 'season_number': int_or_none(feed_data.get('tvSeasonNumber')),
+ 'series': feed_data.get('mediasetprogram$brandTitle'),
+ 'uploader': publish_info.get('description'),
+ 'uploader_id': publish_info.get('channel'),
+ 'view_count': int_or_none(feed_data.get('mediasetprogram$numberOfViews')),
+ })