2 from __future__ import unicode_literals
4 from .common import InfoExtractor
11 class AudiomackIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?audiomack\.com/song/(?P<id>[\w/-]+)'
14 'url': 'https://www.audiomack.com/song/crewneckkramer/story-i-tell',
18 'title': 'story-i-tell'
22 def _real_extract(self, url):
23 # TODO more code goes here, for example ...
24 #webpage = self._download_webpage(url, video_id)
25 #title = self._html_search_regex(r'<h1>(.*?)</h1>', webpage, 'title')
27 assert("/song/" in url)
28 songurl = url[url.index("/song/")+5:]
29 title = songurl[songurl.rindex("/")+1:]
31 t = int(time.mktime(datetime.datetime.now().timetuple()))
32 s = "http://www.audiomack.com/api/music/url/song"+songurl+"?_="+str(t)
33 f = urllib.request.urlopen(s)
34 j = f.read(1000).decode("utf-8")
42 # TODO more properties (see youtube_dl/extractor/common.py)