aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-03-13 22:03:58 +0600
committerSergey M․ <dstftw@gmail.com>2015-03-13 22:03:58 +0600
commitba1d4c04883cafb55e40734776d9d8ba2ef85582 (patch)
tree7c86b9c1607d6db3e53e7aee5ba2b5a66c96b81b
parent517bcca29925548f9b9b121beec1391ef3ecedec (diff)
downloadyoutube-dl-ba1d4c04883cafb55e40734776d9d8ba2ef85582.tar.xz
[beatenpro] Improve display_id
-rw-r--r--youtube_dl/extractor/beatportpro.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/extractor/beatportpro.py b/youtube_dl/extractor/beatportpro.py
index 69657cbde..5c072b131 100644
--- a/youtube_dl/extractor/beatportpro.py
+++ b/youtube_dl/extractor/beatportpro.py
@@ -9,7 +9,7 @@ from ..utils import int_or_none
class BeatportProIE(InfoExtractor):
- _VALID_URL = r'https?://pro\.beatport\.com/track/.+/(?P<id>[0-9]+)'
+ _VALID_URL = r'https?://pro\.beatport\.com/track/(?P<display_id>[^/]+)/(?P<id>[0-9]+)'
_TESTS = [{
'url': 'https://pro.beatport.com/track/synesthesia-original-mix/5379371',
'md5': 'b3c34d8639a2f6a7f734382358478887',
@@ -40,8 +40,11 @@ class BeatportProIE(InfoExtractor):
}]
def _real_extract(self, url):
- track_id = self._match_id(url)
- webpage = self._download_webpage(url, track_id)
+ mobj = re.match(self._VALID_URL, url)
+ track_id = mobj.group('id')
+ display_id = mobj.group('display_id')
+
+ webpage = self._download_webpage(url, display_id)
playables = self._search_regex(
r'window\.Playables\s*=\s*({.*?});', webpage,
@@ -92,7 +95,7 @@ class BeatportProIE(InfoExtractor):
return {
'id': track['id'],
- 'display-id': track['slug'],
+ 'display_id': track.get('slug') or display_id,
'title': title,
'formats': formats,
'thumbnails': images,