- 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
+ reqdata = urlencode_postdata([
+ ('mediaType', 's'),
+ ('mediaId', video_id),
+ ])
+ r = sanitized_Request(
+ 'http://www.hotnewhiphop.com/ajax/media/getActions/', data=reqdata)
+ r.add_header('Content-Type', 'application/x-www-form-urlencoded')
+ mkd = self._download_json(
+ r, video_id, note='Requesting media key',
+ errnote='Could not download media key')
+ if 'mediaKey' not in mkd:
+ raise ExtractorError('Did not get a media key')
+
+ redirect_url = compat_b64decode(video_url_base64).decode('utf-8')
+ redirect_req = HEADRequest(redirect_url)
+ req = self._request_webpage(
+ redirect_req, video_id,
+ note='Resolving final URL', errnote='Could not resolve final URL')
+ video_url = req.geturl()
+ if video_url.endswith('.html'):
+ raise ExtractorError('Redirect failed')
+
+ video_title = self._og_search_title(webpage).strip()
+
+ return {
+ 'id': video_id,
+ 'url': video_url,
+ 'title': video_title,
+ 'thumbnail': self._og_search_thumbnail(webpage),
+ }