1 from __future__ import unicode_literals
3 from .common import InfoExtractor
4 from ..utils import int_or_none
7 class HypemIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?hypem\.com/track/(?P<id>[0-9a-z]{5})'
10 'url': 'http://hypem.com/track/1v6ga/BODYWORK+-+TAME',
11 'md5': 'b9cc91b5af8995e9f0c1cee04c575828',
16 'uploader': 'BODYWORK',
17 'timestamp': 1371810457,
18 'upload_date': '20130621',
22 def _real_extract(self, url):
23 track_id = self._match_id(url)
25 response = self._download_webpage(url, track_id)
27 track = self._parse_json(self._html_search_regex(
28 r'(?s)<script\s+type="application/json"\s+id="displayList-data">(.+?)</script>',
29 response, 'tracks'), track_id)['tracks'][0]
31 track_id = track['id']
34 final_url = self._download_json(
35 'http://hypem.com/serve/source/%s/%s' % (track_id, track['key']),
36 track_id, 'Downloading metadata', headers={
37 'Content-Type': 'application/json'
45 'uploader': track.get('artist'),
46 'duration': int_or_none(track.get('time')),
47 'timestamp': int_or_none(track.get('ts')),