diff options
-rw-r--r-- | test/tests.json | 9 | ||||
-rw-r--r-- | youtube_dl/extractor/__init__.py | 2 | ||||
-rw-r--r-- | youtube_dl/extractor/hotnewhiphop.py | 40 | ||||
-rw-r--r-- | youtube_dl/extractor/youtube.py | 4 | ||||
-rw-r--r-- | youtube_dl/version.py | 2 |
5 files changed, 54 insertions, 3 deletions
diff --git a/test/tests.json b/test/tests.json index ebc7a123c..d34d960f7 100644 --- a/test/tests.json +++ b/test/tests.json @@ -714,5 +714,14 @@ "info_dict": { "title": "Watch Till End: Herd of deer jump over a fence." } + }, + { + "name": "HotNewHipHop", + "url": "http://www.hotnewhiphop.com/freddie-gibbs-lay-it-down-song.1435540.html'", + "file": "1435540.mp3", + "md5": "2c2cd2f76ef11a9b3b581e8b232f3d96", + "info_dict": { + "title": "Freddie Gibbs Songs - Lay It Down" + } } ] diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 03543c607..bffb6d115 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -19,6 +19,7 @@ from .gametrailers import GametrailersIE from .generic import GenericIE from .googleplus import GooglePlusIE from .googlesearch import GoogleSearchIE +from .hotnewhiphop import HotNewHipHopIE from .howcast import HowcastIE from .hypem import HypemIE from .ina import InaIE @@ -137,6 +138,7 @@ def gen_extractors(): TudouIE(), CSpanIE(), WimpIE(), + HotNewHipHopIE(), AuengineIE(), GenericIE() ] diff --git a/youtube_dl/extractor/hotnewhiphop.py b/youtube_dl/extractor/hotnewhiphop.py new file mode 100644 index 000000000..82752f912 --- /dev/null +++ b/youtube_dl/extractor/hotnewhiphop.py @@ -0,0 +1,40 @@ +import re +import base64 + +from .common import InfoExtractor + + +class HotNewHipHopIE(InfoExtractor): + _VALID_URL = r'http://www\.hotnewhiphop.com/.*\.(?P<id>.*)\.html' + + def _real_extract(self, url): + m = re.match(self._VALID_URL, url) + video_id = m.group('id') + + webpage_src = self._download_webpage(url, video_id) + + video_url_base64 = self._search_regex(r'data-path="(.*?)"', + webpage_src, u'video URL', fatal=False) + + if video_url_base64 == None: + video_url = self._search_regex(r'"contentUrl" content="(.*?)"', webpage_src, + u'video URL') + return self.url_result(video_url, ie='Youtube') + + video_url = base64.b64decode(video_url_base64).decode('utf-8') + + video_title = self._html_search_regex(r"<title>(.*)</title>", + webpage_src, u'title') + + # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video. + thumbnail = self._html_search_regex(r'"og:image" content="(.*)"', + webpage_src, u'thumbnail', fatal=False) + + results = [{ + 'id': video_id, + 'url' : video_url, + 'title' : video_title, + 'thumbnail' : thumbnail, + 'ext' : 'mp3', + }] + return results
\ No newline at end of file diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index c7922c533..6c8aa9ade 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -130,7 +130,7 @@ class YoutubeIE(InfoExtractor): self.to_screen(u'RTMP download detected') def _decrypt_signature(self, s): - """Decrypt the key the two subkeys must have a length of 43""" + """Decrypt the key""" if len(s) == 88: return s[48] + s[81:67:-1] + s[82] + s[66:62:-1] + s[85] + s[61:48:-1] + s[67] + s[47:12:-1] + s[3] + s[11:3:-1] + s[2] + s[12] @@ -148,7 +148,7 @@ class YoutubeIE(InfoExtractor): return s[36] + s[79:67:-1] + s[81] + s[66:40:-1] + s[33] + s[39:36:-1] + s[40] + s[35] + s[0] + s[67] + s[32:0:-1] + s[34] else: - raise ExtractorError(u'Unable to decrypt signature, subkeys length %d not supported; retrying might work' % (len(s))) + raise ExtractorError(u'Unable to decrypt signature, key length %d not supported; retrying might work' % (len(s))) def _get_available_subtitles(self, video_id): self.report_video_subtitles_download(video_id) diff --git a/youtube_dl/version.py b/youtube_dl/version.py index d1e848284..4505bff66 100644 --- a/youtube_dl/version.py +++ b/youtube_dl/version.py @@ -1,2 +1,2 @@ -__version__ = '2013.06.34' +__version__ = '2013.06.34.1' |