aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorxavier <xavier.beynon@gmail.com>2014-10-24 21:07:01 -0500
committerxavier <xavier.beynon@gmail.com>2014-10-24 21:07:01 -0500
commitfdfefa1b9c86ef58d943a26a157dc234c2df14d9 (patch)
treec3e0d22582ef1d84d77ca590a9388aaa2e7b8de5 /youtube_dl
parent9e9bc793f3abddc4824cfcb13f569163fb0a4ba7 (diff)
Made changes per phihag
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/__init__.py1
-rw-r--r--youtube_dl/extractor/audiomack.py17
2 files changed, 10 insertions, 8 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index 7f2b4dfcc..78cdf14df 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -79,6 +79,7 @@ __authors__ = (
'Carlos Ramos',
'5moufl',
'lenaten',
+ 'Xavier Beynon'
)
__license__ = 'Public Domain'
diff --git a/youtube_dl/extractor/audiomack.py b/youtube_dl/extractor/audiomack.py
index 2ececa998..bdcc51235 100644
--- a/youtube_dl/extractor/audiomack.py
+++ b/youtube_dl/extractor/audiomack.py
@@ -1,9 +1,9 @@
-# Xavier Beynon 2014
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from .soundcloud import SoundcloudIE
+from ..utils import ExtractorError
import datetime
import time
@@ -15,9 +15,9 @@ class AudiomackIE(InfoExtractor):
#hosted on audiomack
{
'url': 'http://www.audiomack.com/song/roosh-williams/extraordinary',
- 'file': 'Roosh Williams - Extraordinary.mp3',
'info_dict':
{
+ 'id' : 'roosh-williams/extraordinary',
'ext': 'mp3',
'title': 'Roosh Williams - Extraordinary'
}
@@ -39,13 +39,14 @@ class AudiomackIE(InfoExtractor):
def _real_extract(self, url):
#id is what follows /song/ in url, usually the uploader name + title
- id = url[url.index("/song/")+5:]
+ id = self._match_id(url)
#Call the api, which gives us a json doc with the real url inside
- rightnow = int(time.mktime(datetime.datetime.now().timetuple()))
- apiresponse = self._download_json("http://www.audiomack.com/api/music/url/song"+id+"?_="+str(rightnow), id)
- if not url in apiresponse:
- raise Exception("Unable to deduce api url of song")
+ rightnow = int(time.time())
+ apiresponse = self._download_json("http://www.audiomack.com/api/music/url/song/"+id+"?_="+str(rightnow), id)
+
+ if "url" not in apiresponse:
+ raise ExtractorError("Unable to deduce api url of song")
realurl = apiresponse["url"]
#Audiomack wraps a lot of soundcloud tracks in their branded wrapper
@@ -60,7 +61,7 @@ class AudiomackIE(InfoExtractor):
songtitle = self._html_search_regex(r'<h1 class="profile-title song-title"><span class="artist">.*</span>(.*)</h1>', page, "title")
title = artist+" - "+songtitle
return {
- 'id': title, # ignore id, which is not useful in song name
+ 'id': id, # ignore id, which is not useful in song name
'title': title,
'url': realurl,
'ext': 'mp3'