Merge remote-tracking branch 'gitprojs/master'
authorPhilipp Hagemeister <phihag@phihag.de>
Thu, 27 Jun 2013 16:16:41 +0000 (18:16 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Thu, 27 Jun 2013 16:16:41 +0000 (18:16 +0200)
Conflicts:
youtube_dl/extractor/__init__.py

test/tests.json
youtube_dl/extractor/__init__.py
youtube_dl/extractor/hotnewhiphop.py [new file with mode: 0644]
youtube_dl/extractor/youtube.py
youtube_dl/version.py

index ebc7a123c1de30a00941abad2f7e916d6e0991fb..d34d960f7936d5228513f17a71d79224ca758f39 100644 (file)
     "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"
+    }
   }
 ]
index 03543c607e183ef9aeda04d5ac44102af7c53d7e..bffb6d115b15834a7bd88ed19e4e1a027a7888dd 100644 (file)
@@ -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 (file)
index 0000000..82752f9
--- /dev/null
@@ -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
index c7922c533343ca162c922659d34dc867d6839864..6c8aa9ade76fc65808c1fccabea579dc4e8a8278 100644 (file)
@@ -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)
index d1e848284e7b779637ecb663242d5d8d6cb88990..4505bff667980fd32ab5de255a0fe34aaf88f3bf 100644 (file)
@@ -1,2 +1,2 @@
 
-__version__ = '2013.06.34'
+__version__ = '2013.06.34.1'