- matched = re.match(self._VALID_URL, url)
- slug = matched.group('slug')
- album_id = matched.group('album_id')
-
- webpage = self._download_webpage(
- 'http://mp3.zing.vn/album/%s/%s.html' % (slug, album_id), album_id)
- player_xml_url = self._search_regex(
- r'&xmlURL=(?P<xml_url>[^&]+)&', webpage, 'player xml url')
-
- return self._extract_player_xml(
- player_xml_url, album_id,
- playlist_title=self._og_search_title(webpage))
+ page_id = self._match_id(url)
+
+ webpage = self._download_webpage(url, page_id)
+
+ player_json_url = self._search_regex([
+ r'data-xml="([^"]+)',
+ r'&xmlURL=([^&]+)&'
+ ], webpage, 'player xml url')
+
+ playlist_title = None
+ page_type = self._search_regex(r'/(?:html5)?xml/([^/-]+)', player_json_url, 'page type')
+ if page_type == 'video':
+ player_json_url = update_url_query(player_json_url, {'format': 'json'})
+ else:
+ player_json_url = player_json_url.replace('/xml/', '/html5xml/')
+ if page_type == 'album':
+ playlist_title = self._og_search_title(webpage)
+
+ return self._extract_player_json(player_json_url, page_id, page_type, playlist_title)