- player_data = self._download_json('https://www.hungama.com/audio-player-data/track/%s?_country=IN' % video_id, video_id)[0]
- title = player_data.get('song_name') or self._og_search_title(webpage)
- track_data = self._download_json(player_data['file'], video_id)
- media_url = track_data['response']['media_url']
+ data = self._download_json(
+ 'https://www.hungama.com/audio-player-data/track/%s' % video_id,
+ video_id, query={'_country': 'IN'})[0]
+
+ track = data['song_name']
+ artist = data.get('singer_name')
+
+ m3u8_url = self._download_json(
+ data.get('file') or data['preview_link'],
+ video_id)['response']['media_url']
+
+ formats = self._extract_m3u8_formats(
+ m3u8_url, video_id, ext='mp4', entry_protocol='m3u8_native',
+ m3u8_id='hls')
+ self._sort_formats(formats)
+
+ title = '%s - %s' % (artist, track) if artist else track
+ thumbnail = data.get('img_src') or data.get('album_image')