]> Raphaƫl G. Git Repositories - youtubedl/blobdiff - youtube_dl/extractor/hotnewhiphop.py
Adapt changes from Andreas Tille for porting to Salsa.
[youtubedl] / youtube_dl / extractor / hotnewhiphop.py
index 9db5652096acc5ead0cb926791d731d0f6f35565..4703e1894f08f70057ace62fc1411980ea7728b4 100644 (file)
@@ -1,8 +1,7 @@
 from __future__ import unicode_literals
 
 from __future__ import unicode_literals
 
-import base64
-
 from .common import InfoExtractor
 from .common import InfoExtractor
+from ..compat import compat_b64decode
 from ..utils import (
     ExtractorError,
     HEADRequest,
 from ..utils import (
     ExtractorError,
     HEADRequest,
@@ -12,7 +11,7 @@ from ..utils import (
 
 
 class HotNewHipHopIE(InfoExtractor):
 
 
 class HotNewHipHopIE(InfoExtractor):
-    _VALID_URL = r'https?://www\.hotnewhiphop\.com/.*\.(?P<id>.*)\.html'
+    _VALID_URL = r'https?://(?:www\.)?hotnewhiphop\.com/.*\.(?P<id>.*)\.html'
     _TEST = {
         'url': 'http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html',
         'md5': '2c2cd2f76ef11a9b3b581e8b232f3d96',
     _TEST = {
         'url': 'http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html',
         'md5': '2c2cd2f76ef11a9b3b581e8b232f3d96',
@@ -48,7 +47,7 @@ class HotNewHipHopIE(InfoExtractor):
         if 'mediaKey' not in mkd:
             raise ExtractorError('Did not get a media key')
 
         if 'mediaKey' not in mkd:
             raise ExtractorError('Did not get a media key')
 
-        redirect_url = base64.b64decode(video_url_base64).decode('utf-8')
+        redirect_url = compat_b64decode(video_url_base64).decode('utf-8')
         redirect_req = HEADRequest(redirect_url)
         req = self._request_webpage(
             redirect_req, video_id,
         redirect_req = HEADRequest(redirect_url)
         req = self._request_webpage(
             redirect_req, video_id,