- data = {'ax': 1, 'ts': time.time()}
- request = sanitized_Request(url + '?' + compat_urllib_parse_urlencode(data))
- response, urlh = self._download_webpage_handle(
- request, track_id, 'Downloading webpage with the url')
-
- html_tracks = self._html_search_regex(
- r'(?ms)<script type="application/json" id="displayList-data">(.+?)</script>',
- response, 'tracks')
- try:
- track_list = json.loads(html_tracks)
- track = track_list['tracks'][0]
- except ValueError:
- raise ExtractorError('Hypemachine contained invalid JSON.')
-
- key = track['key']
+ response = self._download_webpage(url, track_id)
+
+ track = self._parse_json(self._html_search_regex(
+ r'(?s)<script\s+type="application/json"\s+id="displayList-data">(.+?)</script>',
+ response, 'tracks'), track_id)['tracks'][0]
+